26 lines
679 B
Bash
Executable File
26 lines
679 B
Bash
Executable File
#!/bin/bash
|
|
DOMAIN="apidocs.nxs.solutions"
|
|
EMAIL="info@nxs.solutions"
|
|
STAGING=0 # Set to 1 for testing (to avoid rate limits)
|
|
|
|
# Ensure required directories exist
|
|
if [ ! -d "data/certbot/conf" ]; then
|
|
mkdir -p data/certbot/conf
|
|
fi
|
|
if [ ! -d "data/certbot/www" ]; then
|
|
mkdir -p data/certbot/www
|
|
fi
|
|
|
|
# Run Certbot to get initial certificate
|
|
docker compose run --rm certbot certonly --webroot \
|
|
--webroot-path=/var/www/certbot \
|
|
--email "$EMAIL" \
|
|
-d "$DOMAIN" -d "www.$DOMAIN" \
|
|
--rsa-key-size 4096 \
|
|
--agree-tos \
|
|
--noninteractive \
|
|
$([ "$STAGING" -eq 1 ] && echo "--staging")
|
|
|
|
# Reload Nginx to use the new certificate
|
|
docker compose exec nginx nginx -s reload
|