thinkpading 2025-04-21 21:53 采纳率: 0%
浏览 8

无法打开网页502 Bad Gateway

现象描述:腾讯云上用宝塔面板部署站点之后,配置了域名IP,直接点击IP链接,网页连接很慢,一段时间后返回502 Bad Gateway。(初次建站的时候都还一切正常,后来就不行了,重新部署也是一样的,不知道是什么原因,求助!)

网站异常日志:

2025/04/21 20:08:44 [error] 87081#0: *345 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 106.59.209.3, server: 132.232.229.196, request: "GET /index.php?s=/store/passport/login HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-73.sock:", host: "132.232.229.196

Slow.log

[21-Apr-2025 20:07:34] [pool www] pid 92043
script_filename = /www/wwwroot/testkm.cn/public/index.php
[0x00007f6e11c1fcf0] curl_exec() /www/wwwroot/testkm.cn/application/common.php:160
[0x00007f6e11c1fc50] curlPost() /www/wwwroot/testkm.cn/application/store/controller/Controller.php:138
[0x00007f6e11c1fa30] wxAuth() /www/wwwroot/testkm.cn/application/store/controller/Controller.php:24
[0x00007f6e11c1f970] _initialize() /www/wwwroot/testkm.cn/thinkphp/library/think/Controller.php:59
[0x00007f6e11c1f7d0] __construct() /www/wwwroot/testkm.cn/thinkphp/library/think/App.php:359
[0x00007f6e11c1f770] newInstanceArgs() /www/wwwroot/testkm.cn/thinkphp/library/think/App.php:359
[0x00007f6e11c1f640] invokeClass() /www/wwwroot/testkm.cn/thinkphp/library/think/Loader.php:479
[0x00007f6e11c1f470] controller() /www/wwwroot/testkm.cn/thinkphp/library/think/App.php:580
[0x00007f6e11c1eae0] module() /www/wwwroot/testkm.cn/thinkphp/library/think/App.php:456
[0x00007f6e11c1e7f0] exec() /www/wwwroot/testkm.cn/thinkphp/library/think/App.php:139
[0x00007f6e11c1e170] run() /www/wwwroot/testkm.cn/thinkphp/start.php:19
[0x00007f6e11c1e0f0] [INCLUDE_OR_EVAL]() /www/wwwroot/testkm.cn/public/index.php:21

php-fpm.log

[21-Apr-2025 20:07:34] WARNING: [pool www] child 92043, script '/www/wwwroot/testkm.cn/public/index.php' (request: "GET /index.php?s=/store/passport/login") executing too slow (30.968534 sec), logging
[21-Apr-2025 20:07:34] NOTICE: child 92043 stopped for tracing
[21-Apr-2025 20:07:34] NOTICE: about to trace 92043
[21-Apr-2025 20:07:34] NOTICE: finished trace of 92043
[21-Apr-2025 20:08:44] WARNING: [pool www] child 92043, script '/www/wwwroot/testkm.cn/public/index.php' (request: "GET /index.php?s=/store/passport/login") execution timed out (100.978363 sec), terminating
[21-Apr-2025 20:08:44] WARNING: [pool www] child 92043 exited on signal 15 (SIGTERM) after 100.981196 seconds from start
[21-Apr-2025 20:08:44] NOTICE: [pool www] child 92552 started

调高级别后的php-fpm.log

[21-Apr-2025 20:45:11.924323] DEBUG: pid 103963, fpm_pctl_perform_idle_server_maintenance(), line 361: [pool www] currently 0 active children, 0 spare children
[21-Apr-2025 20:45:12.060873] DEBUG: pid 103963, fpm_children_make(), line 428: [pool www] child 104559 started
[21-Apr-2025 20:45:12.060923] DEBUG: pid 103963, fpm_pctl_on_socket_accept(), line 535: [pool www] got accept without idle child available .... I forked
[21-Apr-2025 20:45:12.060930] DEBUG: pid 103963, fpm_event_loop(), line 430: event module triggered 1 events
[21-Apr-2025 20:45:12.116091] DEBUG: pid 103963, fpm_event_loop(), line 430: event module triggered 1 events
[21-Apr-2025 20:45:12.925964] DEBUG: pid 103963, fpm_pctl_perform_idle_server_maintenance(), line 361: [pool www] currently 1 active children, 0 spare children
[21-Apr-2025 20:45:46.863907] WARNING: pid 103963, fpm_request_check_timed_out(), line 265: [pool www] child 104559, script '/www/wwwroot/testkm.cn/public/index.php' (request: "GET /index.php?s=/store/passport/login") executing too slow (34.747749 sec), logging
[21-Apr-2025 20:45:46.864018] DEBUG: pid 103963, fpm_got_signal(), line 82: received SIGCHLD
[21-Apr-2025 20:45:46.864037] DEBUG: pid 103963, fpm_event_loop(), line 430: event module triggered 1 events
[21-Apr-2025 20:45:46.864051] NOTICE: pid 103963, fpm_children_bury(), line 234: child 104559 stopped for tracing
[21-Apr-2025 20:45:46.864057] NOTICE: pid 103963, fpm_php_trace(), line 200: about to trace 104559
[21-Apr-2025 20:45:46.864415] NOTICE: pid 103963, fpm_php_trace(), line 228: finished trace of 104559
[21-Apr-2025 20:45:46.955552] DEBUG: pid 103963, fpm_pctl_perform_idle_server_maintenance(), line 361: [pool www] currently 1 active children, 0 spare children

  • 写回答

3条回答 默认 最新

  • 阿里嘎多学长 2025-04-22 09:44
    关注

    阿里嘎多学长整理AIGC生成,因移动端显示问题导致当前答案未能完全显示,请使用PC端查看更加详细的解答过程

    问题分析

    用户在腾讯云上使用宝塔面板部署站点,配置了域名IP,但是在点击IP链接时,网页连接很慢,最后返回502 Bad Gateway错误。用户已经重新部署站点,但问题仍然存在。

    可能原因

    1. 服务器负载过高:502 Bad Gateway错误可能是由于服务器负载过高,导致无法处理请求。
    2. 网络问题:网络连接问题也可能导致502 Bad Gateway错误。
    3. 服务器配置问题:宝塔面板的配置可能存在问题,导致502 Bad Gateway错误。

    解决方案

    1. 检查服务器负载:使用 tophtop 命令检查服务器的负载情况,如果负载过高,可以考虑升级服务器配置或添加负载均衡。
    2. 检查网络连接:检查网络连接是否正常,如果网络连接问题,可以尝试 ping 服务器IP地址或使用网络诊断工具来检测网络问题。
    3. 检查宝塔面板配置:检查宝塔面板的配置是否正确,特别是 PHP 配置和服务器配置是否正确。
    4. 检查日志:检查服务器日志和宝塔面板日志,查看是否有相关错误信息。

    核心代码

    无需代码,问题主要是服务器配置和网络问题,需要通过日志和网络诊断来解决。

    评论

报告相同问题?

问题事件

  • 创建了问题 4月21日