【发布时间】:2018-03-16 15:59:00
【问题描述】:
我有一个网站在我自己的运行 CPANEL 的专用服务器上运行。 我有 Apache/2.4.12 和 PHP 版本 5.4.41。
有时我会在日志中看到错误 500 响应。但我似乎无法弄清楚它来自哪里。当我检查页面时......很好并抛出 200 响应代码。当我尝试在谷歌中获取它时,它也很好。但有时,Google 网站管理员会报告我在某些页面中出现错误 500。
这里有人正确调试过这个吗?什么可能触发错误?
日志示例:
46.229.168.79 - - [16/Mar/2018:09:45:04 -0400] "GET /sports-nfl-larry-allen-weight HTTP/1.1" 500 6935 "-" "Mozilla/5.0 (compatible; SemrushBot/1.2~bl; +http://www.semrush.com/bot.html)"
148.64.56.65 - - [16/Mar/2018:09:45:09 -0400] "GET /snap-meee HTTP/1.1" 500 6711 "-" "Mozilla/5.0 (compatible; GrapeshotCrawler/2.0; +http://www.grapeshot.co.uk/crawler.php)"
23.96.208.137 - - [16/Mar/2018:11:30:05 -0400] "GET /rihanna-slams-snapchat HTTP/1.1" 500 7462 "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
72.30.14.91 - - [16/Mar/2018:11:30:07 -0400] "HEAD /kendall-jenner-explained-to-ellen-degeneres HTTP/1.1" 500 - "-" "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)"
只是为了添加更多信息。我获得了 APC 缓存并使用了 CDN 提供程序。但是就像我说的,当我检查它时,页面实际上响应非常快,没有错误。
编辑:错误日志中的某些内容.. 但是当错误 500 发生时,我没有看到任何与时间戳对应的日志。
[Thu Mar 15 17:12:44.532038 2018] [core:error] [pid 26532] [client 194.0.200.11:52727] AH00135: Invalid method in request ------41184676334--
[Thu Mar 15 17:13:01.113257 2018] [core:error] [pid 26538] [client 194.0.200.11:54514] AH00135: Invalid method in request ------41184676334--
[Thu Mar 15 20:10:44.220358 2018] [core:notice] [pid 17916] AH00052: child pid 8905 exit signal Segmentation fault (11)
[Fri Mar 16 05:35:21.280659 2018] [core:error] [pid 25310] [client 71.6.146.185:57523] AH00135: Invalid method in request quit
[Fri Mar 16 08:25:10.126197 2018] [:error] [pid 6358] [client 66.249.69.147:43415] script '/home/****/public_html/index.php' not found or unable to stat
[Fri Mar 16 12:25:22.897389 2018] [mpm_prefork:notice] [pid 17916] AH00173: SIGHUP received. Attempting to restart
[Fri Mar 16 12:25:22.950624 2018] [mpm_prefork:warn] [pid 17916] AH00181: MaxRequestWorkers of 400 exceeds ServerLimit value of 256, decreasing to match
[Fri Mar 16 12:25:23.001101 2018] [ssl:warn] [pid 17916] AH01909: proxy-subdomains-ssl-default-vhost.localhost:443:0 server certificate does NOT include an ID which matches the server name
[Fri Mar 16 12:25:23.138917 2018] [mpm_prefork:notice] [pid 17916] AH00163: Apache/2.4.12 (Unix) OpenSSL/1.0.1e-fips PHP/5.4.41 configured -- resuming normal operations
[Fri Mar 16 12:25:23.138948 2018] [core:notice] [pid 17916] AH00094: Command line: '/usr/local/apache/bin/httpd'
我目前正在修复 MaxRequestWorkers 警告,我认为这与错误 500 无关。
【问题讨论】:
-
检查您的服务器错误日志。它通常在
/var/log/httpd/或/var/log/apache2/中找到,如果找不到,您可能需要联系您的房东。 -
我运行自己的服务器...并且我已经检查了这些日志。我最后的选择是在这里问......因为我无法从日志中看到罪魁祸首。除非我错过了一些值得关注的地方。
-
您正在显示访问日志。您有错误日志中的任何内容吗?确保您没有在 Apache 配置中禁用错误日志(通常为每个站点设置)。日志名称中通常包含
error。 -
不知道是不是日志中的[ssl:warn]...
-
有可能。
script '/home/****/public_html/index.php' not found or unable to stat很有趣,您可能需要仔细检查路径和配置。除非你在重启之前修复了这个问题(SIGHUP)