nativeInstallernginx

Create a virtual host

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.

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

  • 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/conf/nginx-prefix.conf";
    
  • Include the virtual host configuration file for your application in the installdir/nginx/conf/bitnami/bitnami-apps-vhosts.conf file:

    include "installdir/apps/APPNAME/conf/nginx-vhosts.conf";
    
  • Update the application’s nginx-app.conf file at installdir/apps/APPNAME/conf/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;
    
  • 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'] . '/');
    
  • Restart the NGINX server:

    $ sudo installdir/ctlscript.sh restart nginx