Skip to content

Docker + Nginx + Lets Encrypt [with Single/Multi Domain SSL]

Notifications You must be signed in to change notification settings

global-source/docker-nginx-ssl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ubuntu + Nginx + SSL


Packagist Packagist Packagist Packagist

SSL Setup with Lets Encrypt

  • This example is for Multi Domain SSL Setup.
  • If you are planning for single domain, you can ignore 2nd docker/domain.

Step: 1

Dependancy for SSL

$ apt update

$ apt install certbot python3-certbot-nginx

Create Network

$ docker network create web

Step: 2

Build docker image

docker build -t my-docker-app .

docker build -t my-docker-app2 .

Run Docker images with domain name and use the same in nginx.conf

docker run -d --name domain1.com --network web my-docker-app

docker run -d --name domain2.com --network web my-docker-app2

Create LetsEncrypt SSL Certificate

$ certbot -d domain1.com -d domain2.com

Config the Nginx

  • Update the env.sh with your data $ bash env.sh
Command to Run Nginx

$ docker run --name nginx --network web -p 80:80 -p 443:443 -v ./nginx.conf:/etc/nginx/nginx.conf -v /etc/letsencrypt/:/etc/letsencrypt/ nginx

Note:*
    1. Update the domain name as per the image name
    1. Update the (SSL) certificate and key file location
    1. Mount nginx.conf and letsencrypt as virtual dir
    1. Test Image: shankarthiyagu/hello-world

About

Docker + Nginx + Lets Encrypt [with Single/Multi Domain SSL]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages