Skip to content

Instantly share code, notes, and snippets.

@haroonabbasi
Created October 26, 2018 10:26
Show Gist options
  • Save haroonabbasi/1eaea8a16e1ca26da47339c6dab1a334 to your computer and use it in GitHub Desktop.
Save haroonabbasi/1eaea8a16e1ca26da47339c6dab1a334 to your computer and use it in GitHub Desktop.
Nginx and SSL
upstream rest_node_js {
server 127.0.0.1:8000;
}
server {
listen 443 ssl;
server_name findmybusnj.com;
ssl on;
gzip on;
ssl_certificate /etc/letsencrypt/live/findmybusnj.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/findmybusnj.com/privkey.pem;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/findmybusnj.com/fullchain.pem;
ssl_session_timeout 5m;
location / {
proxy_pass http://rest_node_js;
proxy_redirect off;
}
}
server {
listen 80;
server_name findmybusnj.com;
return 301 https://findmybusnj.com$request_uri;
}
server {
listen 80;
server_name www.findmybusnj.com;
rewrite ^/(.*) https://findmybusnj.com/$1 permanent;
}
server {
listen 443;
server_name www.findmybusnj.com;
rewrite ^/(.*) https://findmybusnj.com/$1 permanent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment