Skip to content

Instantly share code, notes, and snippets.

@babadee08
Last active January 26, 2018 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save babadee08/a2f08541f1b3a993a9b12eb7b85c7c58 to your computer and use it in GitHub Desktop.
Save babadee08/a2f08541f1b3a993a9b12eb7b85c7c58 to your computer and use it in GitHub Desktop.
The finale configuration of your nginx config file
#HTTP CONFIG START
server {
listen 80;
server_name domainname.com;
if ($scheme = 'http') {
rewrite ^ https://$http_host$request_uri? permanent;
}
}
server {
listen 443 ssl;
server_name domainname.com;
ssl_certificate /etc/letsencrypt/live/domainname.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domainname.com/privkey.pem;
location / {
proxy_pass http://localhost:3333;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment