awsmastodon

Force HTTPS redirection with NGINX

  • Modify the /opt/bitnami/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 /opt/bitnami/APPNAME;
          return 301 https://$host$request_uri;
      }
    
  • Modify the server section of the /opt/bitnami/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. Refer to the FAQ for more information.

  • Restart NGINX to apply the changes.

Last modification February 9, 2023