-
-
Save s4parke/726521e7f5e453f50c2c to your computer and use it in GitHub Desktop.
node.js upstream nginx config
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 calc_example_org_upstream { | |
server 127.0.0.1:8005; | |
#server 127.0.0.1:8006; | |
#keepalive 64; | |
} | |
server { | |
listen 80; | |
server_name www.calc.example.org; | |
return 301 $scheme://calc.example.org$request_uri; | |
} | |
server { | |
listen 80; | |
server_name calc.example.org; | |
location ~ ^/(assets|css|fonts|images|js|robots.txt|humans.txt|favicon.ico) { | |
root /home/enketo/enketo-express/public; | |
access_log off; | |
expires 1d; | |
} | |
location = / { | |
# Default home page is a redirect | |
rewrite ^ $scheme://calc.example.org/::YYYp permanent; | |
} | |
location / { | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_set_header Connection ""; | |
proxy_http_version 1.1; | |
#proxy_cache one; | |
#proxy_cache_key sfs$request_uri$scheme; | |
proxy_pass http://calc_example_org_upstream; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment