Initial commit
This commit is contained in:
25
bin/init-letsencrypt.sh
Executable file
25
bin/init-letsencrypt.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user