How to set up Nginx HTTP to HTTPS redirection (Default settings)
In case You decide to use this example, place the two config files separately inside /etc/nginx/sites-available and create a symlink for them inside /etc/nginx/sites-enabled (please temporarily remove symlink for your previous configs inside /etc/nginx/sites-enabled . No need to remove them completely)
First file name "Default"
server { listen 80 default_server; listen [::]:80 default_server; server_name Your_server_address.com return 301 https://$host$request_uri; location /{ proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_cache_bypass $http_upgrade; } }
Second file name "https.conf"
# HTTPS Server server { listen 443 ssl; server_name Your_server_address.com; # You can increase the limit if your need to. client_max_body_size 200M; error_log /var/log/nginx/rocketchat.access.log; ssl_certificate your full cheined certificate location ssl_certificate_key your SSL certificate key location ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # dont use SSLv3 ref: POODLE location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_cache_bypass $http_upgrade; } }
, multiple selections available,