nativeInstallerruby

Force HTTPS redirection with NGINX

NOTE: The Approach A sections referred to below do not apply to Bitnami native installers. Users of Bitnami native installers should refer only to the Approach B sections.

Approach A: Bitnami installations using system packages

  • Modify the installdir/nginx/conf/server_blocks/APPNAME-server-block.conf file so that it looks like the example below. In the path above and the code example below, APPNAME is a placeholder which corresponds to the Bitnami application name. Replace this placeholder with the correct filename or path corresponding to the Bitnami application.

      server {
          listen 80 default_server;
          root installdir/APPNAME;
          return 301 https://$host$request_uri;
      }
    
  • Modify the server section of the installdir/nginx/conf/nginx.conf file so that it looks like this:

      server {
            listen 80;
            server_name localhost;
            return 301 https://$host$request_uri;
        }
    
  • After modifying the NGINX configuration file, open port 443 in the server firewall.

  • Restart NGINX to apply the changes.

Approach B: Self-contained Bitnami installations

  • Modify the server section of the installdir/nginx/conf/nginx.conf file so that it looks like this:

    server {
          listen 80;
          server_name localhost;
          return 301 https://$host$request_uri;
      }
    
  • After modifying the NGINX configuration file, open port 443 in the server firewall.

  • Restart NGINX to apply the changes.

Last modification August 13, 2021