Fix Nginx startup and Certbot expansion issues
This commit is contained in:
parent
9cc2fecdf6
commit
ffe3bfc6cd
|
|
@ -93,14 +93,19 @@ EOL
|
|||
echo "Uploading new configuration..."
|
||||
scp boilerhaus.org.conf.new $SERVER_USER@$SERVER_IP:/etc/nginx/sites-available/boilerhaus.org.conf
|
||||
|
||||
# Make sure the site is enabled
|
||||
echo "Ensuring site is enabled..."
|
||||
ssh $SERVER_USER@$SERVER_IP "ln -sf /etc/nginx/sites-available/boilerhaus.org.conf /etc/nginx/sites-enabled/boilerhaus.org.conf"
|
||||
|
||||
# Test Nginx configuration
|
||||
echo "Testing Nginx configuration..."
|
||||
ssh $SERVER_USER@$SERVER_IP "nginx -t"
|
||||
|
||||
# If the test is successful, reload Nginx
|
||||
# If the test is successful, start or reload Nginx
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Reloading Nginx..."
|
||||
ssh $SERVER_USER@$SERVER_IP "systemctl reload nginx"
|
||||
echo "Starting or reloading Nginx..."
|
||||
ssh $SERVER_USER@$SERVER_IP "systemctl is-active nginx || systemctl start nginx"
|
||||
ssh $SERVER_USER@$SERVER_IP "systemctl reload nginx || systemctl restart nginx"
|
||||
echo "Configuration updated successfully!"
|
||||
else
|
||||
echo "Nginx configuration test failed. Restoring backup..."
|
||||
|
|
@ -108,12 +113,8 @@ else
|
|||
echo "Backup restored. Please check the configuration and try again."
|
||||
fi
|
||||
|
||||
# Make sure the site is enabled
|
||||
echo "Ensuring site is enabled..."
|
||||
ssh $SERVER_USER@$SERVER_IP "ln -sf /etc/nginx/sites-available/boilerhaus.org.conf /etc/nginx/sites-enabled/boilerhaus.org.conf"
|
||||
|
||||
# Run Certbot to ensure SSL certificates are set up for all domains
|
||||
echo "Running Certbot to ensure SSL certificates are set up..."
|
||||
ssh $SERVER_USER@$SERVER_IP "certbot --nginx -d boilerhaus.org -d www.boilerhaus.org -d cloud.boilerhaus.org -d git.boilerhaus.org -d bw.boilerhaus.org --non-interactive --agree-tos --email admin@boilerhaus.org"
|
||||
ssh $SERVER_USER@$SERVER_IP "certbot --nginx --expand -d boilerhaus.org -d www.boilerhaus.org -d cloud.boilerhaus.org -d git.boilerhaus.org -d bw.boilerhaus.org --non-interactive --agree-tos --email admin@boilerhaus.org"
|
||||
|
||||
echo "Done!"
|
||||
Loading…
Reference in New Issue