Skip to content

Instantly share code, notes, and snippets.

@bensooraj
Created March 20, 2018 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bensooraj/57001869f8adc3ed622f14b7c3ef4cb6 to your computer and use it in GitHub Desktop.
Save bensooraj/57001869f8adc3ed622f14b7c3ef4cb6 to your computer and use it in GitHub Desktop.
default.conf | Express Application | Load Balancing
upstream node_cluster {
server 127.0.0.1:3000; # Node.js instance 1
server 127.0.0.1:3001; # Node.js instance 2
server 127.0.0.1:3002; # Node.js instance 3
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost; # example.com www.example.com;
location ~ ^/(assets/|images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) {
root /Users/Bensooraj/Desktop/NodeJS_Play/testApp/testApp/public;
access_log off;
expires 24h;
}
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://127.0.0.1:3000/;
proxy_pass http://node_cluster/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment