Last active
December 19, 2019 09:03
-
-
Save LordotU/33e3acd76f750fae7f25d5c4bb08a827 to your computer and use it in GitHub Desktop.
Docker Nginx Reverse Proxy And Let's Encrypt
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
# Run it via command: docker-compose up -d | |
version: '3' | |
services: | |
nginx: | |
image: jwilder/nginx-proxy | |
container_name: nginx-proxy | |
ports: | |
- "80:80" | |
- "443:443" | |
volumes: | |
- conf:/etc/nginx/conf.d | |
- vhost:/etc/nginx/vhost.d | |
- html:/usr/share/nginx/html | |
- certs:/etc/nginx/certs | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
labels: | |
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true" | |
letsencrypt: | |
image: jrcs/letsencrypt-nginx-proxy-companion | |
container_name: nginx-proxy-le | |
depends_on: | |
- nginx | |
environment: | |
DEFAULT_EMAIL: "[email protected]" | |
NGINX_PROXY_CONTAINER: nginx-proxy | |
volumes: | |
- conf:/etc/nginx/conf.d | |
- vhost:/etc/nginx/vhost.d | |
- html:/usr/share/nginx/html | |
- certs:/etc/nginx/certs | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
volumes: | |
conf: | |
vhost: | |
html: | |
certs: | |
# nginx-proxy network should be created earlier via command: docker network create nginx-proxy | |
networks: | |
default: | |
external: | |
name: nginx-proxy |
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
docker run \ | |
--name <container_name> \ | |
--net nginx-proxy \ | |
-e VIRTUAL_HOST=<hostname_resolvable_domain> \ | |
-e LETSENCRYPT_HOST=<hostname_resolvable_domain> \ | |
-v <path_to_hostname_nginx_conf>:/etc/nginx/conf.d/default.conf:ro \ | |
-d nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment