-
docker-compose.yml 配置, 这里单独配置的一个docker-compose.yml,因为这玩意会更新。。。更新了重新下载证书
version: '3.4'
services:
proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
restart: always
ports:
- 80:80
- 443:443
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
volumes:
- ./certs:/etc/nginx/certs:ro
- ./config/nginx/conf.d:/etc/nginx/conf.d
- ./acme:/acmecerts
- ./vhost.d:/etc/nginx/vhost.d
- ./html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
restart: always
letsencrypt-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
# environment:
# - ACME_CA_URI=https://acme-staging-v02.api.letsencrypt.org/directory
#https://acme-staging-v02.api.letsencrypt.org/directory
container_name: letsencrypt
restart: always
volumes:
- ./certs:/etc/nginx/certs
- ./vhost.d:/etc/nginx/vhost.d
- ./html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
depends_on:
- proxy
restart: always
networks:
default:
external:
name: nginx_proxy
-
其他项目的docker-compose.yml (多子域名配置同一个证书的,用逗号隔开,只要在某一个容器中配置就可以了,记得最后配置网络(因为是在不同的docker-compose.yml,只有在同一个网络中才有用))
...
entry.web:
#使用的镜像
image: registry.cn-shanghai.aliyuncs.com/wsl/wsl:entry.web
environment:
- TZ=Asia/Shanghai
- VIRTUAL_HOST=entry.wangshenglong.com
- ENABLE_ACME=true
#容器的映射端口
ports:
- 8081:80
restart: always
home.web:
#使用的镜像
image: registry.cn-shanghai.aliyuncs.com/wsl/wsl:home.web
environment:
- TZ=Asia/Shanghai
- VIRTUAL_HOST=www.wangshenglong.com,
- LETSENCRYPT_HOST=www.wangshenglong.com,entry.wangshenglong.com,tyrz.wangshenglong.com
- ENABLE_ACME=true
#容器的映射端口
ports:
- 8080:80
restart: always