- Create
.env
file based on.env.example
mkdir keys
- Create RSA private and public keys and put them to
./keys
openssl genrsa -traditional -out ./keys/private_key.pem 2048
openssl rsa -in ./keys/private_key.pem -RSAPublicKey_out -out ./keys/public_key.pem
- Start website (nginx) on port 80 (HTTP)
- In
./nginx/nginx.conf
change last line frominclude conf.d/prod.conf;
toinclude conf.d/test.conf;
sudo docker compose up --build
- In
- Retrieve SSL certificates from let's encrypt using certbot or update the certificate
sudo docker compose -f docker-compose-certbot.yml run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d socialaiprofile.top
- Change nginx config to use configuration for port 443 (HTTPS)
- In
./nginx/nginx.conf
change last line frominclude conf.d/test.conf;
toinclude conf.d/prod.conf;
- Restart nginx or docker container with nginx
docker restart nginx
- Check website opens using HTTPS and HTTP redirects to HTTPS
- In
- Renew SSL certificate
sudo docker compose -f docker-compose-certbot.yml run --rm certbot --force-renew