🔧 Troubleshoot Guide / 故障排查手册
Quick diagnostics for common server issues. SSH connection, Nginx 502, Docker problems, disk full, firewall lockout. 常见服务器问题快速诊断。SSH连接、Nginx报错、Docker问题、磁盘满、防火墙锁死。
SSH Issues / SSH问题
Can't connect / 连不上
# Check if server is online / 检查是否在线
ping -c 3 your-server
# Check port / 检查端口
nc -zv your-server 2222
# Check SSH service / 检查SSH服务
systemctl status sshd
tail -50 /var/log/auth.log | grep ssh
Connection slow / 连接慢
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
sed -i 's/#GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/sshd_config
systemctl restart sshd
Nginx Issues / Nginx问题
502 Bad Gateway
# 1. Check backend / 检查后端服务
systemctl status your-app
ss -tlnp | grep 3000
# 2. Check nginx errors / 检查Nginx错误
tail -50 /var/log/nginx/error.log
# 3. Check config / 检查配置
nginx -t
SSL Expired / 证书过期
# Check expiry / 查过期时间
openssl s_client -connect domain.com:443 -servername domain.com 2>/dev/null | openssl x509 -noout -dates
# Renew / 续签
certbot renew
Docker Issues / Docker问题
Logs filling disk / 日志爆满
cat > /etc/docker/daemon.json << 'EOF'
{"log-driver": "json-file", "log-opts": {"max-size": "10m", "max-file": "3"}}
EOF
systemctl restart docker
Disk cleanup / 磁盘清理
docker system df # Check usage / 查看占用
docker system prune -af # Clean all / 全部清理
Common Fixes / 通用修复
| Problem / 问题 | Likely Cause / 原因 | Fix / 解决 |
|---|---|---|
| Port in use / 端口占用 | Stale process | lsof -i :PORT, kill -9 PID |
| Disk full / 磁盘满 | Logs/cache | journalctl --vacuum-time=3d, apt clean |
| Can't install / 装不上 | Locked dpkg | rm /var/lib/dpkg/lock-frontend |
| DNS not resolving / DNS解析不了 | Wrong DNS | Set 8.8.8.8 in /etc/resolv.conf |
📞 Contact / 联系方式
QQ: 3292957 | Email: snowdu@gmail.com
QR Code: see
assets/qr-contact.png
