Created
October 13, 2015 13:48
-
-
Save pintux/45c5fd88199bade4a81e to your computer and use it in GitHub Desktop.
A simple NGINX configuration file to act at reverse-proxy / load balancer for 2 dockerized application nodes
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
worker_processes 2; | |
events { | |
worker_connections 4096; | |
use epoll; | |
} | |
http { | |
upstream nodes { | |
least_conn; | |
server node1:3000; | |
server node2:3000; | |
} | |
include mime.types; | |
default_type application/octet-stream; | |
keepalive_timeout 65; | |
proxy_read_timeout 200; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
gzip on; | |
gzip_min_length 1000; | |
gzip_proxied any; | |
gzip_types text/plain text/html text/css text/xml | |
application/x-javascript application/xml | |
application/atom+xml text/javascript; | |
proxy_next_upstream error; | |
server { | |
listen 80; | |
client_max_body_size 50M; | |
location / { | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_pass http://nodes; | |
proxy_intercept_errors on; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment