Skip to content

Instantly share code, notes, and snippets.

@brunojppb
Last active September 9, 2020 07:41
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 brunojppb/2338f83d4f7cc0e2288c14cf21854c08 to your computer and use it in GitHub Desktop.
Save brunojppb/2338f83d4f7cc0e2288c14cf21854c08 to your computer and use it in GitHub Desktop.
Nginx proxy with Docker
# Caching
# proxy_cache site-cache;
# proxy_cache_key "$cookie_PLAY_LANG$request_uri$http_accept_language";
# proxy_cache_bypass $cookie_session;
# proxy_no_cache $cookie_session;
# proxy_cache_valid 200 303 302 301 60m;
# proxy_cache_valid 404 1m;
# proxy_ignore_headers Cache-Control;
# add_header X-Cache-Status $upstream_cache_status;
# File uploads
client_max_body_size 16m;
# Websockets
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# Proxy Headers
# proxy_redirect off;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-Proto https;
# proxy_set_header X-Forwarded-Ssl on;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
version: '2'
services:
nginx-proxy:
restart: always
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- "/etc/nginx/vhost.d"
- "/usr/share/nginx/html"
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "/etc/nginx/certs"
# My custom nginx configuration
# Increase file upload limit
# cache it more
- "./config/custom_config.conf:/etc/nginx/conf.d/custom_config.conf:ro"
letsencrypt-nginx-proxy-companion:
restart: always
image: jrcs/letsencrypt-nginx-proxy-companion
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes_from:
- "nginx-proxy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment