Skip to content

Instantly share code, notes, and snippets.

@omartrigui
Created June 7, 2018 16:00
Show Gist options
  • Save omartrigui/d8cd2b7cbc8ffb26ceb89a68eb10f909 to your computer and use it in GitHub Desktop.
Save omartrigui/d8cd2b7cbc8ffb26ceb89a68eb10f909 to your computer and use it in GitHub Desktop.
Serving static files with Nginx
upstream nodejs {
server localhost:3000;
}
server {
listen 8080;
server_name localhost;
root ~/workspace/test/app;
location / {
try_files $uri $uri/ @nodejs;
}
location @nodejs {
proxy_redirect off;
proxy_http_version 1.1;
proxy_pass http://nodejs;
proxy_set_header Host $host ;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment