Skip to content

Instantly share code, notes, and snippets.

@Layoric
Created July 28, 2023 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Layoric/ccf909f147bb7b3e349f87cdc56a94b8 to your computer and use it in GitHub Desktop.
Save Layoric/ccf909f147bb7b3e349f87cdc56a94b8 to your computer and use it in GitHub Desktop.
Docker compose for Nginx Reverse Proxy and Lets Encrypt Companion
version: "3.9"
services:
nginx-proxy:
image: nginxproxy/nginx-proxy
container_name: nginx-proxy
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- dhparam:/etc/nginx/dhparam
- certs:/etc/nginx/certs:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
letsencrypt:
image: nginxproxy/acme-companion:2.2
container_name: nginx-proxy-le
restart: always
depends_on:
- "nginx-proxy"
environment:
- DEFAULT_EMAIL=you@example.com
volumes:
- certs:/etc/nginx/certs:rw
- acme:/etc/acme.sh
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
default:
name: nginx
volumes:
conf:
vhost:
html:
dhparam:
certs:
acme:
@Layoric
Copy link
Author

Layoric commented Jul 28, 2023

To use this with your custom docker-compose.yml application, you will need to also join the same nginx network with the following.

networks:
  default:
    external: true
    name: nginx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment