feat: add nginx-proxy

This commit is contained in:
lab 2021-09-20 01:01:16 +08:00
parent 1d2d569b6d
commit 30951bfa53
2 changed files with 55 additions and 0 deletions

26
nginx-proxy/README.md Normal file
View File

@ -0,0 +1,26 @@
# docker run
```shell
# nginx-proxy
docker run -itd \
--name nginx-proxy \
--restart=always \
-p 80:80 \
-p 443:443 \
-v /data/nginx/certs:/etc/nginx/certs \
-v /data/nginx/vhost.d:/etc/nginx/vhost.d \
-v /data/nginx/html:/usr/share/nginx/html \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
jwilder/nginx-proxy:alpine
# letsencrypt-nginx-proxy-companion
docker run -itd \
--name nginx-proxy-letsencrypt \
--restart=always \
--volumes-from nginx-proxy \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /data/acme.sh:/etc/acme.sh \
-e "DEFAULT_EMAIL=hi@esin.io" \
jrcs/letsencrypt-nginx-proxy-companion
```

View File

@ -0,0 +1,29 @@
version: "2"
services:
nginx-proxy:
image: jwilder/nginx-proxy:alpine
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- /data/nginx/certs:/etc/nginx/certs
- /data/nginx/vhost.d:/etc/nginx/vhost.d
- /data/nginx/html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
letsencrypt-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
restart: always
volumes-from: "nginx-proxy"
environment:
- "DEFAULT_EMAIL=hi@esin.io"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /data/acme.sh:/etc/acme.sh
#set environments in service
#- VIRTUAL_HOST=sub.example.com
#- VIRTUAL_PORT=3000
#- LETSENCRYPT_HOST=sub.example.com
#- LETSENCRYPT_EMAIL=admin@example.com