76 lines
2.4 KiB
Bash
Executable file
76 lines
2.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Script to test VSCode server from the server itself
|
|
|
|
set -e
|
|
|
|
SERVER_IP="147.45.152.129"
|
|
SERVER_USER="root"
|
|
|
|
echo "🧪 Testing VSCode server from the server itself..."
|
|
echo ""
|
|
|
|
ssh "$SERVER_USER@$SERVER_IP" << 'ENDSSH'
|
|
set -e
|
|
|
|
echo "📊 Step 1: Checking if nginx is listening on port 443..."
|
|
ss -tuln | grep ':443' || echo "⚠️ Nothing listening on port 443"
|
|
|
|
echo ""
|
|
echo "📊 Step 2: Checking if code-server is listening on port 8443..."
|
|
ss -tuln | grep ':8443' || echo "⚠️ Nothing listening on port 8443"
|
|
|
|
echo ""
|
|
echo "📊 Step 3: Testing local connection to code-server..."
|
|
curl -I http://127.0.0.1:8443 2>&1 | head -10
|
|
|
|
echo ""
|
|
echo "📊 Step 4: Testing nginx proxy to code-server (HTTP)..."
|
|
curl -I -H "Host: vscode.mnemo-cards.online" http://127.0.0.1 2>&1 | head -10
|
|
|
|
echo ""
|
|
echo "📊 Step 5: Testing HTTPS connection locally..."
|
|
curl -I -k https://127.0.0.1 -H "Host: vscode.mnemo-cards.online" 2>&1 | head -10
|
|
|
|
echo ""
|
|
echo "📊 Step 6: Checking SSL certificates..."
|
|
if [ -d "/etc/letsencrypt/live/vscode.mnemo-cards.online" ]; then
|
|
echo "✅ Certificate directory exists"
|
|
ls -la /etc/letsencrypt/live/vscode.mnemo-cards.online/
|
|
|
|
echo ""
|
|
echo "Certificate details:"
|
|
openssl x509 -in /etc/letsencrypt/live/vscode.mnemo-cards.online/fullchain.pem -noout -text | grep -A2 "Subject:"
|
|
openssl x509 -in /etc/letsencrypt/live/vscode.mnemo-cards.online/fullchain.pem -noout -text | grep -A2 "Not After"
|
|
else
|
|
echo "❌ Certificate directory not found"
|
|
fi
|
|
|
|
echo ""
|
|
echo "📊 Step 7: Checking nginx error logs..."
|
|
echo "Last 20 lines of nginx error log:"
|
|
tail -20 /var/log/nginx/error.log
|
|
|
|
echo ""
|
|
echo "📊 Step 8: Checking firewall status..."
|
|
if command -v ufw &> /dev/null; then
|
|
echo "UFW status:"
|
|
ufw status
|
|
else
|
|
echo "UFW not installed"
|
|
fi
|
|
|
|
echo ""
|
|
echo "📊 Step 9: Checking iptables..."
|
|
iptables -L -n | grep -E "(443|REJECT|DROP)" || echo "No blocking rules found for port 443"
|
|
|
|
echo ""
|
|
echo "📊 Step 10: Testing external connection..."
|
|
echo "Attempting to connect to vscode.mnemo-cards.online from the server..."
|
|
curl -I https://vscode.mnemo-cards.online 2>&1 | head -10
|
|
|
|
ENDSSH
|
|
|
|
echo ""
|
|
echo "✅ Test complete!"
|
|
|