Last active
January 22, 2018 18:44
-
-
Save lkmadushan/abc23a9fedcc49fa4f213c5ac741025e to your computer and use it in GitHub Desktop.
Nginx and Let's encrypt Setup
This file contains hidden or 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
#!/usr/bin/env bash | |
# curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > /opt/nginx/nginx.tmpl | |
docker run -d -p 80:80 -p 443:443 \ | |
--name nginx \ | |
--restart always \ | |
-v /etc/nginx/conf.d \ | |
-v /etc/nginx/vhost.d \ | |
-v /usr/share/nginx/html \ | |
-v /opt/nginx/certs:/etc/nginx/certs:ro \ | |
nginx:alpine | |
docker run -d \ | |
--name nginx-gen \ | |
--restart always \ | |
--volumes-from nginx \ | |
-v /opt/nginx/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro \ | |
-v /var/run/docker.sock:/tmp/docker.sock:ro \ | |
jwilder/docker-gen \ | |
-notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf | |
docker run -d \ | |
--name nginx-letsencrypt \ | |
--restart always \ | |
--volumes-from nginx \ | |
-e "NGINX_DOCKER_GEN_CONTAINER=nginx-gen" \ | |
-v /opt/nginx/certs:/etc/nginx/certs:rw \ | |
-v /var/run/docker.sock:/var/run/docker.sock:ro \ | |
jrcs/letsencrypt-nginx-proxy-companion | |
docker run -d \ | |
--name kalpa \ | |
--restart always \ | |
-v $(pwd):/var/www/html \ | |
-e "VIRTUAL_HOST=example.com,www.example.com" \ | |
-e "LETSENCRYPT_HOST=example.me,www.example.com" \ | |
-e "[email protected]" \ | |
lkmadushan/nginx-php-alpine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment