麻烦的FastCGIconfiguration – 503错误

我得到FastCGI hangups一些网站可以访问,但其他人返回503服务不可用错误(如果我等待足够长的时间来响应)。 这个主机上有很多很多的域不可访问。 这是一个有1000个域名的服务器。 它运行良好,但有时直到我们切换到FastCGI缓慢。 然后,它马上加速,但是很多网站都无法访问。 在另外两台服务器上,FastCGI运行正常,有1000个域,我无法确定这个configuration有什么不同。

这是CentOS 5.从/ etc / httpd / logs / error_log中,我重复看到这些条目。 也许他们可以提供我需要做的事情的线索?

[warn] [client 50.50.50.50] mod_fcgid: can't apply process slot for /home/example/public_html/example.com/index.php [warn] mod_fcgid: too much processes, please increase FCGID_MAX_APPLICATION [error] [client 50.50.50.50] Premature end of script headers: index.php [warn] [client 50.50.50.50] mod_fcgid: read data timeout in 400 seconds 

我们的/etc/httpd/conf/php.conf显示了这种安排:

 # Fastcgi configuration for PHP5 LoadModule fcgid_module modules/mod_fcgid.so MaxRequestsPerProcess 1000 #FcgidMaxProcesses 100 #FcgidProcessLifeTime 60 MaxProcessCount 500 IPCCommTimeout 400 IdleTimeout 400 ProcessLifeTime 60 #DefaultMinClassProcessCount 120 AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5 FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4 FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3 FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2 FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml 

通过识别服务器负载瓶颈来解决进程插槽错误。 在我的情况下,它是磁盘I / O。 我通过在Web目录上运行这个命令来解决这个问题。 在这种情况下,所有的网站都在/ home上:

chattr -R + A / home

但是,在你这样做之前,要注意其后果:

http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap6sec73.html

http://en.wikipedia.org/wiki/Stat_%28Unix%29

请注意,chattr只适用于现有的文件。 除非您重新运行chattr,否则较新的文件将不会收到此属性。 如果您在另一个分区上托pipe/ home,那么您可以编辑/ etc / fstab并在该分区上添加noatime参数。

你也可以在你的/ tmp文件夹中每隔一段时间运行一次cron作业,以加快PHP页面执行速度(通常caching在/ tmp中)。

关于“[警告] mod_fcgid:过多的进程,请增加FCGID_MAX_APPLICATION”的其他错误 – 似乎是Apache FastCGI团队提交的错误。 有些人通过重新编译最新代码的源代码来修复它。 有些人通过注释掉C源代码中的错误并重新编译来解决这个问题。