mnemo_cards/tools/deploy/check-nginx.sh

81 lines
2.1 KiB
Bash
Raw Normal View History

2025-11-19 19:32:48 +00:00
#!/bin/bash
# Script to check and reload nginx
set -e
SERVER_IP="147.45.152.129"
SERVER_USER="root"
echo "🔧 Checking and reloading nginx..."
echo ""
ssh "$SERVER_USER@$SERVER_IP" << 'ENDSSH'
set -e
echo "📊 Checking nginx status..."
if /usr/sbin/nginx -v 2>&1; then
echo "✅ nginx is installed"
else
echo "❌ nginx is NOT installed"
exit 1
fi
echo ""
echo "📊 Testing nginx configuration..."
/usr/sbin/nginx -t
echo ""
echo "📊 Checking nginx service status..."
systemctl status nginx --no-pager || true
echo ""
echo "🔄 Reloading nginx..."
systemctl reload nginx
echo "✅ nginx reloaded"
echo ""
echo "📊 Checking if nginx is running..."
systemctl is-active nginx && echo "✅ nginx is active" || echo "❌ nginx is not active"
echo ""
echo "📊 Checking vscode.mnemo-cards.online nginx config..."
if [ -f /etc/nginx/sites-enabled/vscode.mnemo-cards.online ]; then
echo "✅ vscode nginx config is enabled"
elif [ -f /etc/nginx/sites-available/vscode.mnemo-cards.online ]; then
echo "⚠️ vscode nginx config exists but not enabled"
echo "Enabling it..."
ln -sf /etc/nginx/sites-available/vscode.mnemo-cards.online /etc/nginx/sites-enabled/
/usr/sbin/nginx -t && systemctl reload nginx
echo "✅ Enabled and reloaded"
else
echo "❌ vscode nginx config not found"
fi
echo ""
echo "📊 Checking code.mnemo-cards.online DNS resolution..."
if host code.mnemo-cards.online &> /dev/null; then
host code.mnemo-cards.online
else
echo "⚠️ DNS resolution failed for code.mnemo-cards.online"
fi
if host vscode.mnemo-cards.online &> /dev/null; then
host vscode.mnemo-cards.online
else
echo "⚠️ DNS resolution failed for vscode.mnemo-cards.online"
fi
ENDSSH
echo ""
echo "✅ Done!"
echo ""
echo "🌐 Now test these URLs in your browser:"
echo " https://vscode.mnemo-cards.online/"
echo " https://code.mnemo-cards.online/"
echo ""
echo "🔑 Password: AGktOidxrah1KVC0"