Created
October 27, 2017 11:26
-
-
Save somat/ac51f2993b265a0f65b958cd8d19ed5f to your computer and use it in GitHub Desktop.
Nginx http proxy with ssl example.
This file contains hidden or 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
server { | |
listen 80; | |
server_name api.example.com; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
server_name api.example.com; | |
ssl_certificate /etc/letsencrypt/live/api.example.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/api.example.com/privkey.pem; | |
include ssl-params.conf; | |
location / { | |
proxy_pass http://127.0.0.1:3000; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment