From 30951bfa538ff08ac2df7baf0b6d250afd2578f4 Mon Sep 17 00:00:00 2001 From: lab Date: Mon, 20 Sep 2021 01:01:16 +0800 Subject: [PATCH] feat: add nginx-proxy --- nginx-proxy/README.md | 26 ++++++++++++++++++++++++++ nginx-proxy/docker-compose.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 nginx-proxy/README.md create mode 100644 nginx-proxy/docker-compose.yml diff --git a/nginx-proxy/README.md b/nginx-proxy/README.md new file mode 100644 index 0000000..e3836fa --- /dev/null +++ b/nginx-proxy/README.md @@ -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 + +``` \ No newline at end of file diff --git a/nginx-proxy/docker-compose.yml b/nginx-proxy/docker-compose.yml new file mode 100644 index 0000000..f70210b --- /dev/null +++ b/nginx-proxy/docker-compose.yml @@ -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 \ No newline at end of file