diff --git a/deploy-website.sh b/deploy-website.sh index f10b4d5..6d8894f 100755 --- a/deploy-website.sh +++ b/deploy-website.sh @@ -3,8 +3,9 @@ # This script deploys the website to the VPS # Set variables +SERVER_IP="66.179.188.130" REMOTE_USER="root" -REMOTE_HOST="boilerhaus.org" +REMOTE_HOST=$SERVER_IP REMOTE_DIR="/var/www/boilerhaus.org" LOCAL_DIR="." diff --git a/setup-vps.sh b/setup-vps.sh index ed6a718..806e571 100755 --- a/setup-vps.sh +++ b/setup-vps.sh @@ -2,7 +2,10 @@ # This script sets up the VPS with the correct Nginx configuration and deploys the website -echo "=== Setting up VPS for boilerhaus.org ===" +# Set variables +SERVER_IP="66.179.188.130" + +echo "=== Setting up VPS for boilerhaus.org (IP: $SERVER_IP) ===" echo "" # Step 1: Update Nginx configuration diff --git a/update-nginx-config.sh b/update-nginx-config.sh index bbb9aa1..8781d4f 100755 --- a/update-nginx-config.sh +++ b/update-nginx-config.sh @@ -2,9 +2,13 @@ # This script updates the Nginx configuration for boilerhaus.org and its subdomains +# Set variables +SERVER_IP="66.179.188.130" +SERVER_USER="root" # Using root as requested + # Create backup of existing configuration echo "Creating backup of existing Nginx configuration..." -ssh root@boilerhaus.org "cp /etc/nginx/sites-available/boilerhaus.org.conf /etc/nginx/sites-available/boilerhaus.org.conf.bak" +ssh $SERVER_USER@$SERVER_IP "mkdir -p /etc/nginx/sites-available && cp -f /etc/nginx/sites-available/boilerhaus.org.conf /etc/nginx/sites-available/boilerhaus.org.conf.bak 2>/dev/null || true" # Create updated configuration file cat > boilerhaus.org.conf.new << 'EOL' @@ -87,25 +91,29 @@ EOL # Upload the new configuration echo "Uploading new configuration..." -scp boilerhaus.org.conf.new root@boilerhaus.org:/etc/nginx/sites-available/boilerhaus.org.conf +scp boilerhaus.org.conf.new $SERVER_USER@$SERVER_IP:/etc/nginx/sites-available/boilerhaus.org.conf # Test Nginx configuration echo "Testing Nginx configuration..." -ssh root@boilerhaus.org "nginx -t" +ssh $SERVER_USER@$SERVER_IP "nginx -t" # If the test is successful, reload Nginx if [ $? -eq 0 ]; then echo "Reloading Nginx..." - ssh root@boilerhaus.org "systemctl reload nginx" + ssh $SERVER_USER@$SERVER_IP "systemctl reload nginx" echo "Configuration updated successfully!" else echo "Nginx configuration test failed. Restoring backup..." - ssh root@boilerhaus.org "cp /etc/nginx/sites-available/boilerhaus.org.conf.bak /etc/nginx/sites-available/boilerhaus.org.conf" + ssh $SERVER_USER@$SERVER_IP "cp -f /etc/nginx/sites-available/boilerhaus.org.conf.bak /etc/nginx/sites-available/boilerhaus.org.conf 2>/dev/null || true" 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 root@boilerhaus.org "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 -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!" \ No newline at end of file