bash
systemctl status <服务名> 检查服务状态
journalctl -u <服务名> 查看服务日志
bash
top
free -h
df -h
bash
telnet <源服务器IP> <端口> 例:telnet 192.168.1.100 80
nc -zv <源服务器IP> <端口> 使用netcat检查
bash
ufw status Ubuntu防火墙
iptables -L 检查IPTables规则
nginx
Nginx示例配置
location / {
proxy_pass
proxy_set_header Host $host;
proxy_connect_timeout 60s; 调整超时时间
bash
nginx -s reload Nginx重新加载
systemctl restart apache2 Apache重启
bash
tail -f /var/log/nginx/error.log Nginx错误日志
bash
tail -f /var/log/php-fpm/error.log PHP-FPM日志
nginx
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
bash
openssl x509 -enddate -noin -in /path/to/cert.pem 检查证书过期时间
bash
openssl s_client -connect <源服务器IP>:443
nginx
upstream backend {
server 192.168.1.100:80 max_fails=3 fail_timeout=30s;
server 192.168.1.101:80 backup; 备用服务器
1. 重启后端服务:临时恢复可能因瞬时错误导致的问题。
bash
systemctl restart <服务名>
2. 回滚变更:如果近期有配置或代码更新,尝试回滚到稳定版本。
通过以上步骤,逐步排查网络、配置、资源及应用程序问题,通常可定位并解决502错误。
版权声明: 知妳网保留所有权利,部分内容为网络收集,如有侵权,请联系QQ793061840删除,添加请注明来意。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态