🆙 Add ssl support to install sh🆙

This commit is contained in:
Remco
2026-01-20 21:56:29 +01:00
parent cac2e03562
commit 5d2a5b8807
+20
View File
@@ -87,3 +87,23 @@ sudo systemctl enable --now "php${PHP_VERSION}-fpm"
echo "Setup complete. If using a domain, update DNS. Visit http://${SERVER_NAME}/"
# SSL Setup Prompt
echo ""
read -p "Do you want to setup SSL with Let's Encrypt? (y/n) " SETUP_SSL
if [[ "$SETUP_SSL" =~ ^[Yy]$ ]]; then
if [ "${SERVER_NAME}" = "_" ] || [ "${SERVER_NAME}" = "localhost" ]; then
echo "Error: Cannot setup SSL for server name '${SERVER_NAME}'. Please provide a valid domain name when running the script."
echo "Usage: ./setup_linux_nginx.sh <root_dir> <domain>"
else
echo "Installing Certbot..."
sudo apt-get install -y certbot python3-certbot-nginx
echo "Running Certbot for ${SERVER_NAME}..."
# Running non-interactively where possible, but certbot often requires email/tos interaction on first run.
# We assume the user is running this interactively.
sudo certbot --nginx -d "${SERVER_NAME}"
echo "SSL setup complete!"
fi
fi