Skip to content

Boilerplate code for setting up Nginx + Certbot (LetsEncrypt) using docker-compose.

Notifications You must be signed in to change notification settings

dancasey-ie/nginx-certbot-docker

Repository files navigation

NGINX-Certbot-Docker

Boilerplate code for setting up Nginx + Certbot (LetsEncrypt) with auto-renewal using docker-compose. This is really for testing, playing and understanding (I hope).

Why?

I found many repos and tutorials online for setting up LetsEncrypt SSL certificates for Nginx containers, but found them hard to follow and many wrapped important bits in automated scripts.

Requirements

dependency commands
docker commands for Debian / Ubuntu
docker-compose commands for Debian / Ubuntu

Set up

Clone and enter the repo:

git clone https://github.com/dancasey-ie/nginx-certbot-docker
cd nginx-certbot-docker

Set your domain and email variables for generating your LetsEncrypt certificate

export DOMAIN=<your_hosted_domain>
export EMAIL=<your_email>

Configure your DNS to direct both "<your_hosted_domain>" and "www.<your_hosted_domain>" to your server.

If you just want to run using non-secured http:

docker-compose -f compose-http.yml up # make up_http

If you want to run using https you first must run without https and ask Certbot for a certifcate:

docker-compose -f compose-init-ssl.yml up # make init_ssl

Exit with CTRL+C. Then run:

docker-compose -f compose-https.yml up # make up

About

Boilerplate code for setting up Nginx + Certbot (LetsEncrypt) using docker-compose.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published