Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save svdmitrij/fd012e1e58e437937f60469ad95c236d to your computer and use it in GitHub Desktop.
Save svdmitrij/fd012e1e58e437937f60469ad95c236d to your computer and use it in GitHub Desktop.
nginx reverse proxy for docker containers
### /etc/nginx/sites-enabled/default ###
server {
listen 80;
listen [::]:80;
server_name mysite.com;
include /etc/nginx/xtra/server.conf;
location /site_location/ {
proxy_pass http://inner_app.docker:81/;
include /etc/nginx/xtra/proxy.conf;
}
}
### proxy.conf ###
proxy_intercept_errors on;
proxy_busy_buffers_size 32k;
proxy_buffers 64 1k;
proxy_buffer_size 32k;
proxy_buffering off;
proxy_redirect off;
proxy_connect_timeout 90;
proxy_read_timeout 900;
proxy_send_timeout 900;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
### server.conf ###
charset utf-8;
access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/plain application/xml
application/javascript
text/css
text/js
text/xml
application/x-javascript
text/javascript
application/json
application/xml+rss;
client_max_body_size 100m;
client_body_buffer_size 128k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment