Bitnami Nginx Stack

    The Bitnami Nginx Stack greatly simplifies the deployment of Web applications. It includes ready-to-run versions of Nginx, MySQL, PHP and other components.

    How do I download and install Nginx Stack?

    Cloud Server

    Bitnami cloud images extend stack appliances to run in a cloud computing environment. You can run Bitnami applications on a pay-as-you-go basis, programmatically starting and stopping them. Bitnami cloud images are currently available for Amazon EC2Microsoft AzureVMware vCloud AirGooogle Cloud Platform, and DigitalOcean, with support for additional cloud environments planned for the future.

    Virtual Machine/Native Installer

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

    The 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 on the download page or 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 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?

    Cloud Server

    The default installation directory is /opt/bitnami.

    Virtual Machine

    The default installation directory is /opt/bitnami.

    Native Installer

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

    • Windows: C:\Bitnami\nginxstack-VERSION
    • Mac OS X: /Applications/nginxstack-VERSION
    • Linux: /home/USER/nginxstack-VERSION.

    How do I start and stop the servers?

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

    Cloud Images

    Each Bitnami stack includes a control script that lets you easily stop, start and restart servers.

    The script is located at /opt/bitnami/ctlscript.sh. Call it without any arguments to restart all services:

    $ sudo /opt/bitnami/ctlscript.sh start
    

    Or use it to restart a specific service only by passing the service name as argument - for example 'mysql':

    $ sudo /opt/bitnami/ctlscript.sh restart mysql
    

    Virtual Machine

    Each Bitnami stack includes a control script that lets you easily stop, start and restart servers.

    The script is located at /opt/bitnami/ctlscript.sh. Call it without any arguments to restart all services:

    $ sudo /opt/bitnami/ctlscript.sh start
    

    Or use it to restart a specific service only by passing the service name as argument - for example 'mysql':

    $ sudo /opt/bitnami/ctlscript.sh restart mysql
    

    Native Installer

    You can use either the graphical manager tool or the command-line tool to start and stop the servers.

    Graphical Tool

    Bitnami stacks include a graphical tool to manage the servers easily (native installers only). Using this tool, you can start, stop and restart the servers and check the log files.

    manager-servers.png

     

     

     

     

     

     

     

     

     

     

    On Windows:

    • Double-click the "manager-windows.exe" file in your installation directory.  
    • You can also start the Manager tool using the Start Menu path Start -> Program Files -> Bitnami Stack -> Manager.

    On Linux and Mac OS X:

    • Double-click the "manager-osx" or "manager-linux-*" tool in your installation directory. 
    Command-line Tool

    Each Bitnami stack includes a control script that lets you easily stop, start and restart servers.

    The control script is only available for Linux and Mac OS X native installers. The script is located in your installation directory and named ctlscript.sh. Call it without any arguments to restart all services.

    On Linux:
    If your installation directory is /home/USER/wordpress-4.0.1-0, call the control script with the ‘start’ argument to start all servers. For example:

    $ cd /home/USER/wordpress-4.0.1-0
    $ ./ctlscript.sh start
    

    Or use it to restart a specific service only by passing the service name as argument - for example 'mysql':

    $ cd /home/USER/wordpress-4.0.1-0
    $ ./ctlscript.sh restart mysql
    

    On Mac OS X:
    If your installation directory is /Applications/wordpress-4.0.1-0, call the control script with the ‘start’ argument to start all servers. For example:

    $ cd /Applications/wordpress-4.0.1-0
    $ ./ctlscript.sh start
    

    Or use it to restart a specific service only by passing the service name as argument - for example 'mysql':

    $ cd /Applications/wordpress-4.0.1-0
    $ ./ctlscript.sh restart mysql
    

    Tabs end

    How can I run a command in the Nginx Stack?

    Select your platform for instructions on how to run commands in your stack.

    Cloud Server

    Log in to the server console as the 'bitnami' user and run the command as usual. The required environment is automatically loaded for the ‘bitnami’ user.

    Virtual Machine

    Log in to the server console as the 'bitnami' user and run the command as usual. The required environment is automatically loaded for the ‘bitnami’ user.

    Native Installer

    All 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 before accessing different binaries in the stack.

    The 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.

    On Linux:

    At the server console, enter the following commands:

    $ cd ~/nginxstack-VERSION
    $ ./use_nginxstack

    On Windows:

    From the Start Menu, click the Start -> Bitnami Nginx Stack -> Use Nginx Stack shortcut.

    On OS X:

    Open a Terminal and type the following commands:

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

    How can I check the PHP configuration with phpinfo?

    Some versions of the Bitnami Nginx Stack include a docs/ folder that contains some PHP examples. Among these is a phpinfo.php script 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, follow these steps for your platform:

    Cloud Server

    1. Copy the phpinfo.php script from the installation directory to a publicly accessible location under the Web server document root.

    $ cd /opt/bitnami
    $ cp docs/phpinfo.php nginx/html
    

    2. Browse to http://[server-IP-address]/phpinfo.php

    Virtual Machine

    1. Copy the phpinfo.php script from the installation directory to a publicly accessible location under the Web server document root.

    $ cd /opt/bitnami
    $ cp docs/phpinfo.php nginx/html

    2. Browse to http://[server-IP-address]/phpinfo.php

    Native Installer

    1. Copy the phpinfo.php script from the installation directory to a publicly accessible location under the Web server document root.

    $ cd installdir
    $ cp docs/phpinfo.php anginx/html
    

    2. Browse to http://localhost/phpinfo.php (Windows) or http://localhost:8080/phpinfo.php (Linux and Mac OS X).

    Tabs end

    You should see something similar to this page:

    nginx-infophp.png

    How can I create a custom PHP application?

    Cloud Server

    To make your PHP application accessible at the root URL of your server, simply copy your PHP application files into the /opt/bitnami/nginx/html directory. For an example, take a look at the previous question.

    If you want to have several applications running on the Bitnami Nginx Stack, we suggest that you create the same structure that we use when installing Bitnami PHP applications. The easiest way to do this is with the demo application shipped with the Bitnami Nginx Stack. You can use this demo app to quickly bootstrap your custom application, by following these steps:

    • Copy the demo/ directory from the /opt/bitnami/docs directory to the /opt/bitnami/apps directory.
      $ cd /opt/bitnami
      $ sudo cp -r docs/demo apps
      
    • Add the following entry in the /opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf file:
      include "/opt/bitnami/apps/demo/nginx-prefix.conf";
      
    • Restart the Nginx server.
      $ sudo /opt/bitnami/ctlscript.sh restart nginx
      

    You should now be able to access the application at http://[server-IP-address]/demo.

    Virtual Machine

    To make your PHP application accessible at the root URL of your server, simply copy your PHP application files into the /opt/bitnami/nginx/html directory. For an example, take a look at the previous question.

    If you want to have several applications running on the Bitnami Nginx Stack, we suggest that you create the same structure that we use when installing Bitnami PHP applications. The easiest way to do this is with the demo application shipped with the Bitnami Nginx Stack. You can use this demo app to quickly bootstrap your custom application, by following these steps:

    • Copy the demo/ directory from the /opt/bitnami/docs directory to the /opt/bitnami/apps directory.
      $ cd /opt/bitnami
      $ sudo cp -r docs/demo apps
      
    • Add the following entry in the /opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf file:
      include "/opt/bitnami/apps/demo/nginx-prefix.conf";
      
    • Restart the Nginx server.
      $ sudo /opt/bitnami/ctlscript.sh restart nginx
      

    You should now be able to access the application at http://[server-IP-address]/demo.

    Native Installer

    To make your PHP application accessible at the root URL of your server, simply copy your PHP application files into the installdir/nginx/html directory. For an example, take a look at the previous question.

    If you want to have several applications running on the Bitnami Nginx Stack, we suggest that you create the same structure that we use when installing Bitnami PHP applications. The easiest way to do this is with the demo application shipped with the Bitnami Nginx Stack. You can use this demo app to quickly bootstrap your custom application, by following these steps:

    • Copy the demo/ directory from the installdir/docs directory to the installdir/apps directory.
      $ cd installdir
      $ cp -r docs/demo apps
      
    • Add the following entry in the installdir/nginx/conf/bitnami/bitnami-apps-prefix.conf file:
      include "installdir/apps/demo/nginx-prefix.conf";
      
    • Restart the Nginx server.
      $ installdir/ctlscript.sh restart nginx
      

    You should now be able to access the application at http://localhost:8080/demo (Linux and Mac OS X native installers) or http://localhost/demo (Windows native installer).

    Tabs end

    Learn more about the Bitnami PHP application structure.

    How can I install WordPress on top of Nginx Stack?

    Follow the steps below for your platform.

    Cloud Server

    1. Copy the demo/ directory from the /opt/bitnami/docs directory to the /opt/bitnami/apps directory.

    $ cd /opt/bitnami
    $ sudo cp -r docs/demo apps/wordpress
    

    2. Remove the htdocs/ directory from the demo application.

    $ rm -rf /opt/bitnami/apps/wordpress/htdocs
    

    3. Download the latest version of WordPress and extract the files to the apps/wordpress directory, then rename the directory containing the extracted files to apps/wordpress/htdocs.

    $ cd /tmp
    $ wget https://wordpress.org/latest.tar.gz
    $ sudo tar xfvz latest.tar.gz -C /opt/bitnami/apps/wordpress/
    $ sudo mv /opt/bitnami/apps/wordpress/wordpress/ /opt/bitnami/apps/wordpress/htdocs
    

    4. Update the configuration files using the commands below:

    $ sudo sed -i 's/demo/wordpress/g' /opt/bitnami/apps/wordpress/nginx-prefix.conf 
    $ sudo sed -i 's/demo/wordpress/g' /opt/bitnami/apps/wordpress/nginx-vhosts.conf
    

    5. Add the following entry in the /opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf file:

    include "/opt/bitnami/apps/wordpress/nginx-prefix.conf";
    

    6. If you plan to use WordPress permalinks, add this configuration snippet to your /opt/bitnami/apps/wordpress/nginx-app.conf file before the location directive.

    if (!-e $request_filename)
    {
      rewrite ^/wordpress/(.+)$ /wordpress/index.php?q=$1 last;
    }
    

    7. Change ownership for the WordPress application by running the following commands:

    $ sudo chown -R bitnami /opt/bitnami/apps/wordpress
    $ sudo chown -R bitnami.daemon /opt/bitnami/apps/wordpress/htdocs
    

    8. Create a database and database user for WordPress.

    $ /opt/bitnami/mysql/bin/mysql -u root -p
    ...
    mysql> create database bitnami_wordpress;
    mysql> grant all privileges on bitnami_wordpress.* to 'bn_wordpress'@'localhost' 
    identified by 'WORDPRESS-PASSWORD';
    mysql> exit
    

    Keep in mind that you must replace the WORDPRESS-PASSWORD placeholder with a user-defined password that you will also later use when installing WordPress.  

    9. Restart Nginx.

    sudo /opt/bitnami/ctlscript.sh restart nginx
    

    10. Browse to http://[server-IP-address]/wordpress to launch the WordPress Web configuration wizard. Simply follow the steps as prompted by the wizard. When asked for the database configuration and application credentials, use the credentials specified in Step 7, as below:

    Database Name: bitnami_wordpress
    User Name: bn_wordpress
    Password:  WORDPRESS_PASSWORD
    Database Host: localhost
    Table Prefix: wp_
    

    Virtual Machine

    1. Copy the demo/ directory from the /opt/bitnami/docs directory to the /opt/bitnami/apps directory.

    $ cd /opt/bitnami
    $ sudo cp -r docs/demo apps/wordpress
    

    2. Remove the htdocs/ directory from the demo application.

    $ rm -rf /opt/bitnami/apps/wordpress/htdocs
    

    3. Download the latest version of WordPress and extract the files to the apps/wordpress directory, then rename the directory containing the extracted files to apps/wordpress/htdocs.

    $ cd /tmp
    $ wget https://wordpress.org/latest.tar.gz
    $ sudo tar xfvz latest.tar.gz -C /opt/bitnami/apps/wordpress/
    $ sudo mv /opt/bitnami/apps/wordpress/wordpress/ /opt/bitnami/apps/wordpress/htdocs
    

    4. Update the configuration files using the commands below:

    $ sudo sed -i 's/demo/wordpress/g' /opt/bitnami/apps/wordpress/nginx-prefix.conf 
    $ sudo sed -i 's/demo/wordpress/g' /opt/bitnami/apps/wordpress/nginx-vhosts.conf
    

    5. Add the following entry in the /opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf file:

    include "/opt/bitnami/apps/wordpress/nginx-prefix.conf";
    

    6. If you plan to use WordPress permalinks, add this configuration snippet to your /opt/bitnami/apps/wordpress/nginx-app.conf file before the location directive.

    if (!-e $request_filename)
    {
      rewrite ^/wordpress/(.+)$ /wordpress/index.php?q=$1 last;
    }
    

    7. Change ownership for the WordPress application by running the following commands:

    $ sudo chown -R bitnami /opt/bitnami/apps/wordpress
    $ sudo chown -R bitnami.daemon /opt/bitnami/apps/wordpress/htdocs
    

    8. Create a database and database user for WordPress.

    $ /opt/bitnami/mysql/bin/mysql -u root -p
    ...
    mysql> create database bitnami_wordpress;
    mysql> grant all privileges on bitnami_wordpress.* to 'bn_wordpress'@'localhost' 
    identified by 'WORDPRESS-PASSWORD';
    mysql> exit
    

    Keep in mind that you must replace the WORDPRESS-PASSWORD placeholder with a user-defined password that you will also later use when installing WordPress.  

    9. Restart Nginx.

    sudo /opt/bitnami/ctlscript.sh restart nginx
    

    10. Browse to http://[server-IP-address]/wordpress to launch the WordPress Web configuration wizard. Simply follow the steps as prompted by the wizard. When asked for the database configuration and application credentials, use the credentials specified in Step 7, as below:

    Database Name: bitnami_wordpress
    User Name: bn_wordpress
    Password:  WORDPRESS_PASSWORD
    Database Host: localhost
    Table Prefix: wp_
    

    Native Installer

    1. Copy the demo/ directory from the installdir/docs directory to the installdir/apps directory. For example, on Linux and Mac OS X, you can use the following commands:

    $ cd installdir
    $ cp -r docs/demo apps/wordpress
    

    2. Remove the htdocs/ directory from the demo application. For example, on Linux and Mac OS X, you can use the following commands:

    $ rm -rf installdir/apps/wordpress/htdocs
    

    3. Download the latest version of WordPress and extract the files to the apps/wordpress directory, then rename the directory containing the extracted files to apps/wordpress/htdocs. For example, on Linux and Mac OS X, you can use the following commands:

    $ cd /tmp
    $ wget https://wordpress.org/latest.tar.gz
    $ tar xfvz latest.tar.gz -C installdir/apps/wordpress/
    $ mv installdir/apps/wordpress/wordpress/ installdir/apps/wordpress/htdocs
    

    4. Update the configuration files and replace all references to demo with wordpress. For example, on Linux and Mac OS X, you can use the following commands:

    $ sudo sed -i 's/demo/wordpress/g' installdir/apps/wordpress/nginx-prefix.conf 
    $ sudo sed -i 's/demo/wordpress/g' installdir/apps/wordpress/nginx-vhosts.conf
    

    5. Add the following entry in the installdir/nginx/conf/bitnami/bitnami-apps-prefix.conf file.

    include "installdir/apps/wordpress/nginx-prefix.conf";
    

    6. If you plan to use WordPress permalinks, add this configuration snippet to your installdir/apps/wordpress/nginx-app.conf file before the location directive.

    if (!-e $request_filename)
    {
      rewrite ^/wordpress/(.+)$ /wordpress/index.php?q=$1 last;
    }
    

    7. Change ownership for the WordPress application by running the following commands (Linux and Mac OS X only):

    $ chown -R bitnami installdir/apps/wordpress
    $ chown -R bitnami.daemon installdir/apps/wordpress/htdocs
    

    8. Create a database and database user for WordPress.

    $ installdir/mysql/bin/mysql -u root -p
    ...
    mysql> create database bitnami_wordpress;
    mysql> grant all privileges on bitnami_wordpress.* to 'bn_wordpress'@'localhost' 
    identified by 'WORDPRESS-PASSWORD';
    mysql> exit
    

    Keep in mind that you must replace the WORDPRESS-PASSWORD placeholder with a user-defined password that you will also later use when installing WordPress.  

    9. Restart Nginx. You can use the graphical manager  or the following command (Linux and Mac OS X only):

    installdir/ctlscript.sh restart nginx
    

    10. Browse to http://localhost/wordpress (Windows native installer) or http://localhost:8080/wordpress (Linux and Mac OS X native installers) to launch the WordPress Web configuration wizard. Simply follow the steps as prompted by the wizard. When asked for the database configuration and application credentials, use the credentials specified in Step 7, as below:

    Database Name: bitnami_wordpress
    User Name: bn_wordpress
    Password:  WORDPRESS-PASSWORD
    Database Host: localhost
    Table Prefix: wp_
    

    Tabs end
     

    Once the configuration wizard has ended, you should have your WordPress site running on Nginx.

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

     

     

     

     

     

     

     

     

     

     

    How can I access phpMyAdmin?

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

    For security reasons, these applications are accessible only when using 127.0.0.1 as the hostname. To access them from a remote system, you must create an SSH tunnel that routes requests to the Apache Web server from 127.0.0.1. This implies that you must have an SSH private key and be able to connect to your server over SSH in order to access these applications remotely.
     

    IMPORTANT: Before following the steps below, ensure that your Apache and MySQL/PostgreSQL servers are running.

     

    NOTE: The steps below suggest using port 8888 for the SSH tunnel. If this port is already in use by another application on your local machine, replace it with any other port number greater than 1024 and modify the steps below accordingly. Similarly, if you have enabled Varnish, your stack's Apache Web server might be running on port 81. In this case, modify the steps below to use port 81 instead of port 80 for the tunnel endpoint.

     

    Follow the steps below for your platform.

    Bitnami Cloud Hosting

    On Windows:

    • Make sure you can log in to the server using PuTTY. Refer to these instructions for more information.
    • Open a new SSH session to the server and in the PuTTY settings for the new session, click "Connection → SSH → Tunnels" section and create a secure tunnel for the phpMyAdmin application by forwarding source port "8888" to destination port "localhost:80".
    • Click the "Add" button to add the secure tunnel configuration to the session.

    • Go back to the "Session" section and save your changes by clicking the "Save" button.
    • Click the "Open" button to open a new SSH session to the server.

    On Linux and Mac OS X:

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

    Remember to replace 'bitnami-hosting.pem' in the previous commands with the path to your private key file, and 'xyz.bitnamiapp.com' with the public IP address or hostname of your server. Note that if successful, this command will create an SSH tunnel but will not display any output on the server console.

    While the tunnel is active, you should be able to access phpMyAdmin and phpPgAdmin through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin and http://127.0.0.1:8888/phppgadmin respectively.

    To log in, use username 'root' for phpMyAdmin or 'postgres' for phpPgAdmin. For the application password, refer to the "Servers -> Manage Server" page of your Bitnami Cloud Hosting dashboard, under the "Application Password" section.

    Refer to this page for more information on obtaining application credentials.

    Microsoft Azure

    On Windows:

    • Make sure you can log in to the server using PuTTY. Refer to these instructions for more information.
    • Open a new SSH session to the server and in the PuTTY settings for the new session, click "Connection → SSH → Tunnels" section and create a secure tunnel for the phpMyAdmin application by forwarding source port "8888" to destination port "localhost:80".
    • Click the "Add" button to add the secure tunnel configuration to the session.

    • Go back to the "Session" section and save your changes by clicking the "Save" button.
    • Click the "Open" button to open a new SSH session to the server.

    On Linux and Mac OS X:

    $ ssh -N -L 8888:127.0.0.1:80 bitnami1@xyz.cloudapp.net
    

    Remember to replace 'bitnami1' with the SSH username from your credentials pair and 'xyz.cloudapp.net' with the public IP address or hostname of your server. Note that if successful, this command will create an SSH tunnel but will not display any output on the server console.

    While the tunnel is active, you should be able to access phpMyAdmin and phpPgAdmin through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin and http://127.0.0.1:8888/phppgadmin respectively.

    To log in, use username 'root' for phpMyAdmin or 'postgres' for phpPgAdmin and password 'bitnami'.

    Google Cloud Platform

    On Windows:

    • Make sure you can log in to the server using PuTTY. Refer to these instructions for more information.
    • Open a new SSH session to the server and in the PuTTY settings for the new session, click "Connection → SSH → Tunnels" section and create a secure tunnel for the phpMyAdmin application by forwarding source port "8888" to destination port "localhost:80".
    • Click the "Add" button to add the secure tunnel configuration to the session.

    • Go back to the "Session" section and save your changes by clicking the "Save" button.
    • Click the "Open" button to open a new SSH session to the server.

    On Linux and Mac OS X:

    $ ssh -N -L 8888:127.0.0.1:80 -i bitnami-gce-project-name.pem bitnami@100.101.102.103

    Remember to replace 'bitnami-gce-project-name.pem' in the previous commands with the path to your private key file, and '100.101.102.103' with the public IP address or hostname of your server. Note that if successful, this command will create an SSH tunnel but will not display any output on the server console.

    While the tunnel is active, you should be able to access phpMyAdmin and phpPgAdmin through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin and http://127.0.0.1:8888/phppgadmin respectively.

    To log in, use username 'root' for phpMyAdmin or 'postgres' for phpPgAdmin. For the application password, follow the steps below:

    • Browse to the Bitnami Launchpad for Google Cloud Platform dashboard and sign in if required using your Bitnami account.
    • Select the "Virtual Machines" menu item.
    • Select your Bitnami AMP Stack server from the resulting list.
    • Obtain credentials by selecting "Show" under "Credentials".

    Refer to this page for more information on obtaining application credentials.

    Virtual Machine

    On Windows:

    • Make sure you can log in to the server using PuTTY. Refer to these instructions for more information.
    • Open a new SSH session to the server and in the PuTTY settings for the new session, click "Connection → SSH → Tunnels" section and create a secure tunnel for the phpMyAdmin application by forwarding source port "8888" to destination port "localhost:80".
    • Click the "Add" button to add the secure tunnel configuration to the session.

    • Go back to the "Session" section and save your changes by clicking the "Save" button.
    • Click the "Open" button to open a new SSH session to the server.

    On Linux and Mac OS X:

    $ ssh -N -L 8888:127.0.0.1:80 bitnami@192.168.1.1
    

    Remember to replace '192.168.1.1' with the network IP address or hostname of your virtual server. Note that if successful, this command will create an SSH tunnel but will not display any output on the server console.

    While the tunnel is active, you should be able to access phpMyAdmin and phpPgAdmin through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin and http://127.0.0.1:8888/phppgadmin respectively.

    Alternative Approach: Allow Access from All Hosts

    Alternatively, if you are running the virtual machine in a secure environment, you can enable access to phpMyAdmin and phpPgAdmin from hosts other than 127.0.0.1 by editing the /opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf file and modifying the Allow and Require directives as below:

      Default directive Modified directive
    Apache 2.2 Allow from 127.0.0.1 Allow from all
    Apache 2.4+ Require local Require all granted

    You can also use the example configuration file below if you wish:

     <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>
    

    Restart Apache to have the changes take effect:

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

    You should now be able to access phpMyAdmin and phpPgAdmin by browsing to http://[virtual-machine-IP-address]/phpmyadmin and http://[virtual-machine-IP-address]/phppgadmin respectively.

    To log in, use username 'root' for phpMyAdmin or 'postgres' for phpPgAdmin. The default password is 'bitnami'.

    Native Installer

    You should be able to access phpMyAdmin directly, by browsing to http://127.0.0.1:8080/phpmyadmin or http://127.0.0.1/phpmyadmin.

    You should be able to access phpPgAdmin by browsing to http://127.0.0.1:8080/phppgadmin or http://127.0.0.1/phppgadmin.

    The username is 'root' for phpMyAdmin and 'postgres' for phpPgAdmin, and the password is the one specified by you during the installation process.

    Tabs end

    How to increase the upload size limit in Nginx Stack?

    Add the client_max_body_size directive inside the http { } section of the /opt/bitnami/nginx/conf/nginx.conf file (for cloud servers and virtual machines) and the installdir/nginx/conf/nginx.conf file (for native installers).

    For instance, to increase your upload size to 20MB, add the following line:

    client_max_body_size 20m;
    

    Remember to restart the Nginx server for your changes to take effect.

    To increase the upload file size limit for PHP, follow the steps described here.

    How to create a Virtual Host?

    To create virtual hosts for an application with Nginx lets you configure virtual hosts for your applications, such that you can access them at (for example) http://appname.example.com instead of http://example.com/appname. Select your platform below for detailed instructions.

    NOTE: Replace APPNAME in the instructions below with the actual path to your application.

    Cloud Server

    1. Edit the /opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf file and comment out the line below so that it looks like this:

    #include "/opt/bitnami/apps/APPNAME/nginx-prefix.conf";
    

    2. Include the virtual host configuration file for your application in the /opt/bitnami/nginx/conf/bitnami/bitnami-apps-vhosts.conf file:

    include "/opt/bitnami/apps/APPNAME/nginx-vhosts.conf";
    

    3. Update the application's nginx-app.conf file at /opt/bitnami/apps/APPNAME/nginx-app.conf with the revised application URL if necessary. For example, you might replace the line

    rewrite ^/wordpress/(.+)$ /wordpress/index.php?q=$1 last;
    

    with

    rewrite ^/(.+)$ /index.php?q=$1 last;
    

    4. Update the application configuration to reflect the revised URL if necessary. This is an application-specific step and different applications will require different changes. For example, if you are using WordPress, you would need to edit the /opt/bitnami/apps/wordpress/htdocs/wp-config.php file and add the following lines:

    define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');                   
    define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/'); 
    

    5. Restart the Nginx server:

    $ sudo /opt/bitnami/ctlscript.sh restart nginx
    

    Virtual Machine

    1. Edit the /opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf file and comment out the line below so that it looks like this:

    #include "/opt/bitnami/apps/APPNAME/nginx-prefix.conf";
    

    2. Include the virtual host configuration file for your application in the /opt/bitnami/nginx/conf/bitnami/bitnami-apps-vhosts.conf file:

    include "/opt/bitnami/apps/APPNAME/nginx-vhosts.conf";
    

    3. Update the application's nginx-app.conf file at /opt/bitnami/apps/APPNAME/nginx-app.conf with the revised application URL if necessary. For example, you might replace the line

    rewrite ^/wordpress/(.+)$ /wordpress/index.php?q=$1 last;
    

    with

    rewrite ^/(.+)$ /index.php?q=$1 last;
    

    4. Update the application configuration to reflect the revised URL if necessary. This is an application-specific step and different applications will require different changes. For example, if you are using WordPress, you would need to edit the /opt/bitnami/apps/wordpress/htdocs/wp-config.php file and add the following lines:

    define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');                   
    define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/'); 
    

    5. Restart the Nginx server:

    $ sudo /opt/bitnami/ctlscript.sh restart nginx
    

    Native Installer

    1. Edit the installdir/nginx/conf/bitnami/bitnami-apps-prefix.conf file and comment out the line below so that it looks like this:

    #include "installdir/apps/APPNAME/nginx-prefix.conf";
    

    2. Include the virtual host configuration file for your application in the installdir/nginx/conf/bitnami/bitnami-apps-vhosts.conf file:

    include "installdir/apps/APPNAME/nginx-vhosts.conf";
    

    3. Update the application's nginx-app.conf file at installdir/apps/APPNAME/nginx-app.conf with the revised application URL if necessary. For example, you might replace the line

    rewrite ^/wordpress/(.+)$ /wordpress/index.php?q=$1 last;
    

    with

    rewrite ^/(.+)$ /index.php?q=$1 last;
    

    4. Update the application configuration to reflect the revised URL if necessary. This is an application-specific step and different applications will require different changes. For example, if you are using WordPress, you would need to edit the installdir/apps/wordpress/htdocs/wp-config.php file and add the following lines:

    define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');                   
    define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/'); 
    

    5. Restart the Nginx server using the graphical manager or control script.

    $ installdir/ctlscript.sh restart nginx
    
    Tag page (Edit tags)
    • No tags
    Page statistics
    50043 view(s), 50 edit(s) and 29731 character(s)

    Comments

    You must login to post a comment.