解决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的错误日志如图(图片来自网络)
分析:
看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。
进入面板后
如果还是没有解决这个问题,请参照
1、刷新网页,发现不在500错误了。如果还有500错误,请在上层目录(/home/www.jiancn.com) chmod -R 755 .
2、自己使用这个方法没有成功,仅做参照- PHP5是用mod_fcgid方式运行的,但运行一段时间之后,有时候会莫名其妙的出现500错误,也看不出是哪个php程序错误,不过html文件倒能正常解析,查看用户的$HOME/statistics/logs/error_log文件,会发现大量这样的内容:
- [Fri Aug 10 01:00:43 2007] [error] [client 202.108.23.76] Premature end of scrip
- t headers: index.php
- [Fri Aug 10 01:01:20 2007] [error] [client 60.191.82.228] Premature end of scrip
- t headers: index.php
- 而在系统的log文件/var/log/apache/error_log中,是这样的错误:
- [Fri Aug 10 01:03:05 2007] [notice] mod_fcgid: process /var/www/vhosts/fwolf.com
- /httpdocs/blog/index.php(21666) exit(communication error), terminated by calling
- exit(), return code: 120
- G到一些资料,第一类错误是脚本执行被中断,没有返回完整的http header;第二类错误是cgi程序的执行被强行中止。根本原因是fastcgi会自动kill掉一些发呆的、长时间没有响应的进程(要不它比较快,比较省内存啊),但是fastcgi的默认idle时间设置过于苛刻(官方文档中每个选项都有默认的时间值),所以有些处理比较慢、需要调用外部资源的程序就有可能被误杀,所以先略微调整一下,继续观察:
- IdleTimeout 600
- ProcessLifeTime 3600
- MaxProcessCount 8
- DefaultMinClassProcessCount 3
- DefaultMaxClassProcessCount 3
- IPCConnectTimeout 30
- IPCCommTimeout 600
- #MaxRequestsPerProcess 500
- IdleTimeout 发呆时限
- ProcessLifeTime 一个进程的最长生命周期,过期之后无条件kill
- MaxProcessCount 最大进程个数
- DefaultMinClassProcessCount 每个程序启动的最小进程个数
- DefaultMaxClassProcessCount 每个程序启动的最大进程个数
- IPCConnectTimeout 程序响应超时时间
- IPCCommTimeout 与程序通讯的最长时间,上面的错误有可能就是这个值设置过小造成的
- MaxRequestsPerProcess 每个进程最多完成处理个数,达成后自杀,因为PHP最多只处理500次请求。不过这个是mod_fcgid 1.11版本添加的,我们主机上暂时不支持。
- 上述选项的确切作用我也不是十分清楚,先用着这个设置,再根据情况调整。
复制代码 |
|
|
|
|