Skip to content

Instantly share code, notes, and snippets.

@codeZoner
Last active January 4, 2018 10:54
Show Gist options
  • Save codeZoner/1f70a7621db5e0eb072a61ff47cbc673 to your computer and use it in GitHub Desktop.
Save codeZoner/1f70a7621db5e0eb072a61ff47cbc673 to your computer and use it in GitHub Desktop.
Nginx Reverse Proxy Setup with Lets Encrypt
//https://cloud.google.com/community/tutorials/nginx-reverse-proxy-docker
//Run the proxy, but this time declaring volumes so that the Let's Encrypt companion can populate them with certificates
docker run -d -p 80:80 -p 443:443 \
--name nginx-proxy \
-v $HOME/certs:/etc/nginx/certs:ro \
-v $HOME/nginx/etc/nginx/vhost.d:/etc/nginx/vhost.d \
-v $HOME/nginx/usr/share/nginx/html:/usr/share/nginx/html \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
--restart=always \
--net reverse-proxy \
--label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true \
jwilder/nginx-proxy
docker run -d \
--name nginx-letsencrypt \
--volumes-from nginx-proxy \
--net reverse-proxy \
-v $HOME/certs:/etc/nginx/certs:rw \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
--restart=always \
jrcs/letsencrypt-nginx-proxy-companion
docker run -d --name apache2-fpm \
--net reverse-proxy \
-v /home/ec2-user/zedmin/app:/var/www/html \
-e 'LETSENCRYPT_EMAIL=user@example.com' \
-e 'LETSENCRYPT_HOST=www.example.com' \
-e 'VIRTUAL_HOST=www.example.com' \
--restart=always \
fahim0173/drupal-apache-php7-fpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment