Created
November 29, 2016 05:58
-
-
Save JaniKibichi/868f9086a0ac2587615d7712ccff70f1 to your computer and use it in GitHub Desktop.
Configuring Nginx for HTTPS - Ubuntu 16.04 LTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Start of server blocks | |
# HTTP - redirect all requests to HTTPS: | |
server { | |
listen 80; | |
#listen [::]:80 default_server ipv6only=on; | |
server_name www.another.com another.com; | |
return 301 https://$server_name$request_uri; | |
} | |
# HTTPS - proxy requests on to local Node.js app: | |
server { | |
listen 443 http2; | |
server_name another.com www.another.com; | |
ssl on; | |
# Use certificate and key provided by Let's Encrypt: | |
ssl_certificate /etc/letsencrypt/live/www.another.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/www.another.com/privkey.pem; | |
ssl_session_timeout 5m; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; | |
# Pass requests for / to http://127.0.0.1:8190: | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://127.0.0.1:8190/; | |
proxy_ssl_session_reuse off; | |
proxy_set_header Host $http_host; | |
proxy_cache_bypass $http_upgrade; | |
proxy_redirect off; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment