yepengding / nginx-ssl

Automatically set up SSL in Nginx with Docker.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nginx-ssl

Automatically set up SSL in Nginx with Docker.

Quickstart

This will create a new Nginx instance hosting a website protected by SSL.

  1. Install docker compose
  2. Clone the repository
https://github.com/yepengding/nginx-ssl.git
  1. Modify setup.sh
  • Replace domain with your domain name
  1. Assign permissions to setup.sh
chmod +x setup.sh
  1. (Optional) Copy your homepage files into folder nginx/hp

  2. Run setup.sh

./setup.sh

Customize Nginx Configuration

  1. Edit nginx/conf/app.conf

  2. Reload Nginx configuration

docker compose exec nginx nginx -s reload

Generate Certificate

  1. Assign permissions to generate.sh
chmod +x generate.sh
  1. Run generate.sh
./generate.sh [domain]

Renew Certificate

Renew all certificates

  1. Assign permissions to renew.sh
chmod +x renew.sh
  1. Run renew.sh
./renew.sh
  1. Restart to apply changes to the Nginx instance
docker compose restart

Renew the certificate for a specific domain

  1. Run command
docker compose run --rm certbot certonly --force-renew -d [domain]
  1. Restart to apply changes to the Nginx instance
docker compose restart

About

Automatically set up SSL in Nginx with Docker.

License:MIT License


Languages

Language:Shell 76.0%Language:HTML 24.0%