Created
June 7, 2018 16:00
-
-
Save omartrigui/d8cd2b7cbc8ffb26ceb89a68eb10f909 to your computer and use it in GitHub Desktop.
Serving static files with Nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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