Bitnami Nginx Stack

    The Bitnami Nginx Stack is an easy to install software platform that greatly simplifies the deployment of Open Source web stacks. It includes ready-to-run versions of Nginx, MySQL, PHP and other components. Bitnami Nginx Stack is distributed for free under the Apache 2.0 license.

    How do I download and install Nginx Stack?

    nginxstack-stack-110x117.png

    You can download Bitnami Nginx Stack for your platform at https://bitnami.com/stack/nginx. There are installers available for Windows, OS X and Linux operating systems. 

    Bitnami Nginx Stack can also be deployed as virtual machines. If you are using the virtual machine, please see our Virtual Appliances documentation for instructions on logging into the machine.

    The Stacks can be also deployed as AMIs in the Amazon cloud. Please take a look at our Amazon Cloud Images quick guide to see how to connect to the instance from your machine.

    Bitnami Nginx Stack is distributed free of charge under the Apache 2.0 license.

    Which components are installed with Nginx Stack?

    The Bitnami Nginx Stack ships the components listed below. If you want to know which specific version of each component is bundled in the stack you are downloading, check the README.txt file in the Stack installation directory. You can also find more information about each component using the links below.

    Main components:

    • Nginx Web server
    • MySQL database server
    • PHP-FPM
    • phpMyAdmin web application management tool for MySQL database

    Dependencies and additional components:

    • Varnish proxy cache server
    • ImageMagick tool
    • SQLite database
    • XDebug module
    • Memcache module
    • APC module
    • GD library
    • OpenSSL library
    • CURL library
    • OpenLDAP library
    • PEAR and PECL package manager tools

    What is the default installation directory?

    When using native installers the default installation directory depends on the platform and can be changed during the installation:

    win_platform.png On Windows: C:\BitNami\nginxstack-VERSION

    mac_platform.png On OS X: /Applications/nginxstack-VERSION

    linux_platform.png On Linux: /home/user/nginxstack-VERSION

    If you are using a virtual machine or the AMI, the default installation directory is "/opt/bitnami".

    How do I start and stop the servers?

    The Nginx Stack ships several servers that must be started before you will be able to work with them. By default, MySQL database, Nginx servers and PHP-FPM are started after the installation.

    Graphical tool

    The Nginx Stack include a graphical tool to manage the servers easily. You can find the "manager-osx" or "manager-linux" tool in your installation directory. Using this tool, you can Start, Stop or Restart the servers and check the log files. You can click on the icon to start it.

    nginx-manager-screen.pngmanager-osx.png

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Command line tool

    If you prefer, you can use the "ctlscript.sh" utility from the command line. This script is in the installation directory.

    linux_platform.png

    On Virtual Machines and Cloud images:

    $ sudo /opt/bitnami/ctlscript.sh start

    A native installer on Linux:

    $ cd ~/nginxstack-version
    $ ./ctlscript.sh start

    mac_platform.png

     On OS X: You can start the Manager tool from the installation directory or you can use the "ctlscript.sh" utility from a Terminal.

    host:~ user$ cd /Applications/nginxstack-version
    host:~ user$ ./ctlscript.sh start

     

    How can I run a command in the Nginx Stack?

    All of the Native Installers for Bitnami Stacks are completely self-contained and run independently of the rest of the software or libraries installed on your system. To work correctly, certain environment variables need to be set when you want to invoke commands to access different binaries. Note that in virtual machines or AMIs, the environment is already loaded for the "bitnami" user automatically and the below is not necessary.

    BitNami console is a script to load the Stack environment. This console is useful to run any command included in the Stack: mysql, php, openssl, ruby, rake among others.

    linux_platform.pngOn Linux:

    $ cd ~/nginxstack-version
    $ ./use_nginxstack
    
    

     

    mac_platform.png

    On OS X:

    Open a Terminal and type the following:

    hostname:~ user$ cd /Applications/nginxstack-version
    hostname:~ user$ ./use_nginxstack 

    Note: If you are using BitNami Cloud Hosting, a virtual machine or a Cloud image the Stack environment is loaded by default and you don't need to start the console.

     

    How can I check the PHP configuration with phpinfo?

    Once the installation or deployment finishes, you can access the welcome page from your browser. If you have installed the stack on a local machine as a regular user, you can access it at http://localhost:8080 on OS X and Linux. If not, you can specify the IP address of the server where you installed the Stack.

    You should see something similar to this page:

     

    There is a "docs" folder in the installation directory that contains some PHP examples. There is a "phpinfo.php" script file that shows the current PHP configuration and is typically used to check that PHP was installed correctly. In order to be able to access it, you first need to place it in a publicly accessible location. Copy the installdir/docs/phpinfo.php file into the installdir/nginx/html folder and go to your browser to check the enabled PHP modules. By accessing http://localhost:8080/phpinfo.php (or http://localhost:8080/phpinfo.php if running in port 8080). You should see something similar to this page:

     

    How can I create a custom PHP application?

    If you want your PHP application to be accessible at the root URL ( http://localhost/ ), you can simply copy your PHP files into the installdir/nginx/html folder. For an example, take a look at phpinfo.

    If you want to have several applications running on top of Nginx Stack, we suggest that you create the same structure that we use when installing Bitnami PHP applications. Nginx Stack ship a demo application with this structure that can help you get started. Simply copy the installdir/docs/demo folder into the installdir/apps directory and add the following line at the end of the installdir/nginx/conf/bitnami/bitnami-apps-prefix.conf file:

    include "installdir/apps/demo/conf/nginx-prefix.conf"
    

     

    Substitute installdir with the actual installation directory for your deployment.

    Once you are done with the above, restart the Nginx server. If you are running the stack in your desktop or laptop, you can use the bundled graphical Manager tool that is included in your installation directory.

    You should be able to access the demo application at http://localhost/demo or http://localhost:8080/demo. You should see a "Hello world" message in your browser.

    You can learn more about the BitNami PHP application structure here.

     
     

    How can I install WordPress on top of Nginx Stack?

    In this section we are going to explain how to install WordPress on Nginx Stack. We are going to assume that you are using a Virtual Machine or a Cloud Image. In case of Native Installers the steps are similar to these. 

     
    Run the following command to get root privileges and go to your installation directory.
    sudo -s
    cd /opt/bitnami
     
    Copy the demo project to the apps folder and remove htdocs folder
    cp -r docs/demo/ apps/wordpress
    rm -rf apps/wordpress/htdocs
     
    Download the latest WordPress and extract the files in apps/wordpress, then rename apps/wordpress to apps/wordpress/htdocs.
    wget https://wordpress.org/latest.tar.gz
    tar xfvz latest.tar.gz -C apps/wordpress/
    mv apps/wordpress/wordpress/ apps/wordpress/htdocs
    
     
    Now substitute demo for wordpress in conf files and include application prefix file to Nginx prefixes file.
    sed -i 's/demo/wordpress/g' apps/wordpress/conf/nginx-prefix.conf apps/wordpress/conf/nginx-vhosts.conf
    echo -e 'include "/opt/bitnami/apps/wordpress/conf/nginx-prefix.conf";\n' >> /opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf
    
     
    If you plan to use WordPress pretty permalinks, add this configuration snippet to your apps/wordpress/conf/nginx-app.conf before the location directive.
     
        if (!-e $request_filename)
        {
            rewrite ^/wordpress/(.+)$ /wordpress/index.php?q=$1 last;
        }
     
     
    Change ownership for WordPress app running the following command.
    chown -R bitnami apps/wordpress
    chown -R bitnami.daemon apps/wordpress/htdocs
     
     
    Create a database and user for WordPress 
    /opt/bitnami/mysql/bin/mysql -uroot -p
    ...
    create database bitnami_wordpress;
    grant all privileges on bitnami_wordpress.* to 'bn_wordpress'@'localhost' identified by 'WORDPRESS_PASSWORD';
    
     
    Keep in mind that  WORDPRESS_PASSWORD is the password that you are going to for WordPress database user.
     
    Now open in your browser http:/YOUR_DOMAIN/wordpress to see the web wizard. From here, simply follow the steps. You'll be asked for the database configuration and application credentials. For the database the credentials are those that you just specified in the previous command:
     
    Database Name: bitnami_wordpress
    
    User Name: bn_wordpress
    
    Password:  WORDPRESS_PASSWORD
    
    Database Host: localhost
    
    Table Prefix: wp_
     
    After adding this information you will have your WordPress site running!
     

    Screenshot from 2014-08-21 17:47:51.png

     

     

     

     

     

     

     

     

     

     
     

    How can I access phpMyAdmin?

    phpMyAdmin is a popular web-based management tools for the MySQL database.

    For security reasons, these applications will be accessible only when using 127.0.0.1 as the hostname. If you are using a native installer you can access from your own machine but if you are using a Virtual Machine, Amazon cloud image or Windows Azure cloud image, please check the connection steps below.

    Amazon cloud / BitNami Hosting

    By default phpMyAdmin and phpPgAdmin are not accessible from the outside for security reasons. In order to access them, you can create an SSH tunnel to Apache, sending your requests to your webserver from 127.0.0.1 (localhost).

    You should follow these steps to create the tunnel:

    1. Get your SSH private key if you don't have it already. More info

     

    Note: Below we use port 8888 as an example, in most cases this port will be available and you will be able to use it. If that port is already used by other application in your local machine you can replace the port 8888 with any other port number greater than 1024.

     

    2. Create the tunnel.

    - If you are in Linux or Mac you can run the following in a Terminal in your local machine (using your Public DNS instead of xyz.bitnamiapp.com):

    $ ssh -N -L 8888:127.0.0.1:80 -i bitnami-hosting.pem bitnami@xyz.bitnamiapp.com
    

    - If you are using Windows, you can use Putty:

    • Follow the steps described here
    • Before opening the connection. Go to Connection -> SSH -> Tunnels, enter the values below and click "Add" button:
      • Source port: "8888"
      • Destination: "localhost:80" 
    • Click Open

    3. While the tunnel is active you can connect to the web application at http://127.0.0.1:8888/phpmyadmin or http://127.0.0.1:8888/phppgadmin in your browser. The default login is:

    • username: root ("administrator" for legacy versions) for MySQL or postgres for PostgreSQL database.
    • password: bitnami (for BitNami AMIs), <application password> (for BitNami Cloud Hosting)

    Take a look at this link about how to get your application password for BCH servers

     

    Note: If you have enabled Varnish, it is possible that you changed the Apache port to 81. In this case you should specify this port to access phpMyAdmin

    $ ssh -N -L 8888:127.0.0.1:81 -i bitnami-hosting.pem bitnami@xyz.bitnamiapp.com

    Native Installer

    To test your phpMyAdmin installation, first make sure that your Apache and MySQL servers are up and running.  For phpPgAdmin you should check that the PostgreSQL database is running.
     
    To do so, you can use the included "ctlscript.sh" utility. The installdir for Virtual Appliances and AMIs is "/opt/bitnami".
    $ cd your_installdir
    $ ./ctlscript.sh status
    

    If you need to start or stop the servers, you just have to follow the steps described here.

    You can access your phpMyAdmin installation by opening a browser and typing http://127.0.0.1:8080/phpmyadmin or http://127.0.0.1/phpmyadmin. And to access phpPgAdmin, you can type the following urls instead: http://127.0.0.1:8080/phppgadmin or http://127.0.0.1/phppgadmin

    phpmyadmin.png

    For phpMyAdmin the default root user is root, and for phpPgAdmin the default database root user is postgres. The password is the same that you set during the installation.

    Virtual Machine

    If you are running the Virtual Appliance in a secure environment, you can enable it by editing the "/opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf" file and replace "Allow from 127.0.0.1" with "Allow from all" (if your server is running Apache 2.2) or "Require local" with "Require all granted" (if you server is running Apache 2.4 or later) :

     <IfDefine USE_PHP_FPM>
        <Proxy "unix:/opt/bitnami/php/var/run/phpmyadmin.sock|fcgi://phpmyadmin-fpm" timeout=300>
        </Proxy>
    </IfDefine>
    <Directory "/opt/bitnami/apps/phpmyadmin/htdocs">
    
    # AuthType Basic                                                                                                                                          
    # AuthName phpMyAdmin                                                                                                                                     
    # AuthUserFile "/opt/bitnami/apache2/users"                                                                                           
    # Require valid-user                                                                                                                                      
    AllowOverride None
    
    <IfModule php5_module>
            php_value upload_max_filesize 80M
    php_value post_max_size 80M
    </IfModule>
    
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    Satisfy all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
    ErrorDocument 403 "For security reasons, this URL is only accesible using localhost (127.0.0.1) as the hostname"
    
    
        <IfDefine USE_PHP_FPM>
           <FilesMatch \.php$>
             SetHandler "proxy:fcgi://phpmyadmin-fpm/"
           </FilesMatch>
        </IfDefine>
    
    </Directory>
    

    Then you should restart Apache to load the changes:

    $ cd /opt/bitnami
    $ sudo ./ctlscript.sh restart apache
    

    Then you can access at the same URL with "/phpmyadmin" or "/phppgadmin", for example http://YOUR_IP/phpmyadmin

    For phpMyAdmin the default root user is root, and for phpPgAdmin the default database root user is postgres. For Virtual Appliances the password is "bitnami" (or "bitnami1" in the Magento case)

    Azure cloud

    By default phpMyAdmin and phpPgAdmin are not accessible from the outside for security reasons. In order to access them, you can create an SSH tunnel to Apache, sending your requests to your webserver from 127.0.0.1 (localhost).

    You should follow these steps to create the tunnel:

    1. Create the tunnel.

    - If you are in Linux or Mac you can run the following in a Terminal in your local machine (using your Public DNS instead of xyz.bitnamiapp.com):

    $ ssh -N -L 8888:127.0.0.1:80 your_azure_user@xxx.cloudapp.com
    

    - If you are using Windows, you can use Putty:

    • Follow the steps described here
    • Before opening the connection. Go to Connection -> SSH -> Tunnels, enter the values below and click "Add" button:
      • Source port: "8888"
      • Destination: "localhost:80" 
    • Click Open

    2. While the tunnel is active you can connect to the web application at http://127.0.0.1:8888/phpmyadmin or http://127.0.0.1:8888/phppgadmin in your browser. The default login is:

    • username: root for MySQL or postgres for PostgreSQL database.
    • password: bitnami (for BitNami Azure images) or bitnami1 in the Magento case.

    Tabs end

    Tag page (Edit tags)
    • No tags
    Page statistics
    5806 view(s), 34 edit(s) and 14893 character(s)

    Comments

    You must login to post a comment.