From 5d2a5b8807029f475befb6daabda79a66f887dbf Mon Sep 17 00:00:00 2001 From: Remco Date: Tue, 20 Jan 2026 21:56:29 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20Add=20ssl=20support=20to=20insta?= =?UTF-8?q?ll=20sh=F0=9F=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Updated_Cms/setup_linux_nginx.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Updated_Cms/setup_linux_nginx.sh b/Updated_Cms/setup_linux_nginx.sh index b604671ff3..8c21ba398e 100644 --- a/Updated_Cms/setup_linux_nginx.sh +++ b/Updated_Cms/setup_linux_nginx.sh @@ -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 " + 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 +