Automatically set up SSL in Nginx with Docker.
This will create a new Nginx instance hosting a website protected by SSL.
- Install docker compose
- Clone the repository
https://github.com/yepengding/nginx-ssl.git
- Modify
setup.sh
- Replace
domain
with your domain name
- Assign permissions to
setup.sh
chmod +x setup.sh
-
(Optional) Copy your homepage files into folder
nginx/hp
-
Run
setup.sh
./setup.sh
-
Edit
nginx/conf/app.conf
-
Reload Nginx configuration
docker compose exec nginx nginx -s reload
- Assign permissions to
generate.sh
chmod +x generate.sh
- Run
generate.sh
./generate.sh [domain]
- Assign permissions to
renew.sh
chmod +x renew.sh
- Run
renew.sh
./renew.sh
- Restart to apply changes to the Nginx instance
docker compose restart
- Run command
docker compose run --rm certbot certonly --force-renew -d [domain]
- Restart to apply changes to the Nginx instance
docker compose restart