Created
March 9, 2017 18:13
-
-
Save BKeanu1989/e092b3bc80ba2beb2050a304bc3e9deb to your computer and use it in GitHub Desktop.
nginx - config
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
# sudo nano /etc/nginx/sites-enabled/default | |
# HTTP — redirect all traffic to HTTPS | |
server { | |
listen 80; | |
listen [::]:80 default_server ipv6only=on; | |
return 301 https://$host$request_uri; | |
} | |
# HTTPS — proxy all requests to the Node app | |
server { | |
# Enable HTTP/2 | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_name app.example.com; | |
# Use the Let’s Encrypt certificates | |
ssl_certificate /etc/letsencrypt/live/app.example.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem; | |
# Include the SSL configuration from cipherli.st | |
include snippets/ssl-params.conf; | |
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://localhost:5000/; | |
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