回答

收藏

解决webmin/virtualmin mod_fcgid出现500错误的简单方法

工程问答 工程问答 2500 人阅读 | 0 人回复 | 2013-06-03

mod_fcgid出现500错误的解决

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


webmin有时候出现php返回500错误,html页面和图片打开正常,重启了apache也没有用,php页面都不正常,出现500错误的现象,初步分析是apache的问题。查找apache的错误日志如图(图片来自网络)

2242_120307165007.png



分析:

看web日志

Connection reset by peer: mod_fcgid: error reading data from FastCGI server


按照网络上的提示查看了,suexe日志(tail -f /var/log/httpd/suexec.log):

directory is writable by others: (/home/www.jiancn.com/fcgi-bin)

原因就在这里了,directory is writable by others

解决办法:

执行命令 chmod -R 755 /home/www.jiancn.com/fcgi-bin

新手可以借用WINSCP 修改如图



然后重启apache,刷新就可以了

重启方法
--------------------
Virtualmin---服务---配置网站
restart-apache 在很多页面的右上角就有apache的“应用修改”的字样,点击他即可重启apache。

7807_100523132132.png

进入面板后

6273_100827165618.png


如果还是没有解决这个问题,请参照


1、刷新网页,发现不在500错误了。如果还有500错误,请在上层目录(/home/www.jiancn.com) chmod -R 755 .


2、自己使用这个方法没有成功,仅做参照
  1. PHP5是用mod_fcgid方式运行的,但运行一段时间之后,有时候会莫名其妙的出现500错误,也看不出是哪个php程序错误,不过html文件倒能正常解析,查看用户的$HOME/statistics/logs/error_log文件,会发现大量这样的内容:

  2. [Fri Aug 10 01:00:43 2007] [error] [client 202.108.23.76] Premature end of scrip
  3. t headers: index.php
  4. [Fri Aug 10 01:01:20 2007] [error] [client 60.191.82.228] Premature end of scrip
  5. t headers: index.php
  6. 而在系统的log文件/var/log/apache/error_log中,是这样的错误:

  7. [Fri Aug 10 01:03:05 2007] [notice] mod_fcgid: process /var/www/vhosts/fwolf.com
  8. /httpdocs/blog/index.php(21666) exit(communication error), terminated by calling
  9. exit(), return code: 120
  10. G到一些资料,第一类错误是脚本执行被中断,没有返回完整的http header;第二类错误是cgi程序的执行被强行中止。根本原因是fastcgi会自动kill掉一些发呆的、长时间没有响应的进程(要不它比较快,比较省内存啊),但是fastcgi的默认idle时间设置过于苛刻(官方文档中每个选项都有默认的时间值),所以有些处理比较慢、需要调用外部资源的程序就有可能被误杀,所以先略微调整一下,继续观察:


  11.     IdleTimeout 600
  12.     ProcessLifeTime 3600
  13.     MaxProcessCount 8
  14.     DefaultMinClassProcessCount 3
  15.     DefaultMaxClassProcessCount 3
  16.     IPCConnectTimeout 30
  17.     IPCCommTimeout 600
  18.     #MaxRequestsPerProcess 500

  19. IdleTimeout 发呆时限
  20. ProcessLifeTime 一个进程的最长生命周期,过期之后无条件kill
  21. MaxProcessCount 最大进程个数
  22. DefaultMinClassProcessCount 每个程序启动的最小进程个数
  23. DefaultMaxClassProcessCount 每个程序启动的最大进程个数
  24. IPCConnectTimeout 程序响应超时时间
  25. IPCCommTimeout 与程序通讯的最长时间,上面的错误有可能就是这个值设置过小造成的
  26. MaxRequestsPerProcess 每个进程最多完成处理个数,达成后自杀,因为PHP最多只处理500次请求。不过这个是mod_fcgid 1.11版本添加的,我们主机上暂时不支持。
  27. 上述选项的确切作用我也不是十分清楚,先用着这个设置,再根据情况调整。
复制代码
关注下面的标签,发现更多相似文章
您需要登录后才可以回帖 登录 | 注册

本版积分规则

郑重声明:本站属技术交流,非赢利性网站。
本站言论纯属发表者个人意见,与“建筑在线”立场无关。
涉及政治言论一律删除,请所有会员注意. 本站资源由会员从网上收集整理所得,版权属于原作者。
本站所有资源是进行学习和科研测试之用,请在下载后24小时删除
本站出于学习和科研的目的进行交流和讨论,如有侵犯原作者的版权
请来信告知,我们将立即做出整改,并给予相应的答复,谢谢合作!