Force HTTPS redirection with Nginx

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and Mac OS X) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). Learn more.

Modify the installdir/nginx/conf/bitnami/bitnami.conf file so that it looks like this:

server {
      listen 80;
      server_name localhost;
      return 301 https://$host$request_uri;
      include "installdir/nginx/conf/bitnami/bitnami-apps-prefix.conf";

After modifying the Nginx configuration file:

  • Open port 443 in the server firewall.

  • Restart Nginx to apply the changes.

Last modification September 11, 2018