Last active
December 1, 2019 20:04
-
-
Save thomasfr/8653547 to your computer and use it in GitHub Desktop.
nginx vhost / site config file
This file contains 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 node_backend { | |
server 127.0.0.1:3000; | |
keepalive 32; | |
} | |
server { | |
root /var/www/testapp/public; | |
index index.html; | |
server_name example.com localhost; | |
location / { | |
#auth_basic "Restriced"; | |
#auth_basic_user_file /etc/nginx/htpasswd; | |
try_files $uri @backend; | |
## or | |
#try_files $uri $uri/ @backend; | |
} | |
location @backend { | |
## If you use express, make sure you set "trust proxy" to true | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Proto http; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
## Make sure you know what this means. Default nginx setting for proxy_buffering is 'on' | |
proxy_buffering off; | |
## Keep the connection open / alive | |
proxy_http_version 1.1; | |
proxy_set_header Connection ""; | |
proxy_pass http://node_backend; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment