Skip to content

Instantly share code, notes, and snippets.

@joatmon08
Last active July 22, 2017 00:12
Show Gist options
  • Save joatmon08/b7e9c03e421949222848f5c657716cb8 to your computer and use it in GitHub Desktop.
Save joatmon08/b7e9c03e421949222848f5c657716cb8 to your computer and use it in GitHub Desktop.
reference-nginx-reverse-proxy
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 test: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