Last active
July 22, 2017 00:21
-
-
Save joatmon08/a8d73bc2c0792540dc81889aed9da288 to your computer and use it in GitHub Desktop.
nginx Reverse Proxy with Explicit Upstream Servers
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
worker_processes 1; | |
events { worker_connections 1024; } | |
http { | |
log_format compression '$remote_addr - $remote_user [$time_local] ' | |
'"$request" $status $upstream_addr ' | |
'"$http_referer" "$http_user_agent" "$gzip_ratio"'; | |
upstream testapp { | |
server 172.19.0.3:80; | |
server 172.19.0.4:80; | |
} | |
server { | |
listen 8080; | |
access_log /var/log/nginx/access.log compression; | |
location /hello/ { | |
proxy_pass http://testapp/; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Host $server_name; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment