Skip to content

Instantly share code, notes, and snippets.

@somat
Created October 27, 2017 11:26
Show Gist options
  • Save somat/ac51f2993b265a0f65b958cd8d19ed5f to your computer and use it in GitHub Desktop.
Save somat/ac51f2993b265a0f65b958cd8d19ed5f to your computer and use it in GitHub Desktop.
Nginx http proxy with ssl example.
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