Skip to content

Instantly share code, notes, and snippets.

@danielkhoo
Created August 31, 2018 10:30
Show Gist options
  • Save danielkhoo/38b51a36ac4cc6f321a3c77d27aa5516 to your computer and use it in GitHub Desktop.
Save danielkhoo/38b51a36ac4cc6f321a3c77d27aa5516 to your computer and use it in GitHub Desktop.
Nginx Proxy for Node
server_name mynewsite.com www.mynewsite.com;
location / {
#----------Add this section-----------
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:3000;
proxy_redirect off;
#----------Add this section-----------
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment