Last active
June 8, 2022 13:35
-
-
Save stefanopascazi/b4bd2745ff0f4df5b9213fb02648441a to your computer and use it in GitHub Desktop.
Create nginx-proxy container with acme-companion for auto create a valid Lets Encrypt certificate
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
#/bin/bash | |
echo "Create docker network nginx-proxy" | |
docker network create nginx-proxy | |
echo "Create conf.d folder in {$PWD}" | |
mkdir -p $PWD/conf.d | |
echo "Docker run nginx-proxy container" | |
docker run -d -p 80:80 -p 443:443 --restart=always \ | |
-v certs:/etc/nginx/certs \ | |
-v vhost:/etc/nginx/vhost.d \ | |
-v html:/usr/share/nginx/html \ | |
-v $PWD/conf.d:/etc/nginx/conf.d \ | |
-v /var/run/docker.sock:/tmp/docker.sock:ro \ | |
--net nginx-proxy \ | |
--name nginx-proxy \ | |
jwilder/nginx-proxy | |
echo "Docker run acme-companion" | |
docker run -d \ | |
--volumes-from nginx-proxy --restart=always \ | |
-v acme:/etc/acme.sh \ | |
-v /var/run/docker.sock:/var/run/docker.sock:ro \ | |
--env "DEFAULT_EMAIL=youremail@email.com" \ | |
--net nginx-proxy \ | |
--name nginx-proxy-acme \ | |
nginxproxy/acme-companion | |
echo "Finish" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment