Created
April 20, 2014 04:45
-
-
Save taka-wang/11105264 to your computer and use it in GitHub Desktop.
nginx load balancer for node.js application
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
user www-data; | |
worker_processes 4; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} | |
http { | |
server_names_hash_bucket_size 64; # multiple domains | |
upstream app_a { | |
server 127.0.0.1:3000; # node 1 | |
server 127.0.0.1:3001; # node 2 | |
} | |
server { | |
listen 81; | |
server_name localhost; | |
access_log /var/log/nginx/access.log; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://app_a/; | |
proxy_redirect off; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment