由于DMZ上的代理错误,长时间运行的程序超时


Long running progam times out to proxy error over DMZ

我已经设置了一个DMZ来运行一个网站。大部分代码都在运行DebianRelease 7.0(喘息)64位的应用程序服务器上。我还有一个运行centos6.5的网络服务器。它充当应用程序服务器的代理。我在两者上都设置了LAMP,我的网页都是用PHP编写的。web服务器上的PHP脚本调用应用程序服务器上的PHP脚本。应用程序服务器脚本调用一个长时间运行(>1分钟)的可执行文件(该文件是用C++开发的)。60秒后(由我的手表计时),脚本失败,并显示以下消息。

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /appServer/scriptName.php.
Reason: Error reading from remote server
Apache/2.2.15 (CentOS) Server at sitename.com Port 80

我注释掉了应用程序服务器PHP脚本中的代码,并将问题缩小到长时间运行的C++可执行文件。我还在shell中运行了可执行文件,没有任何问题。因此,显然存在超时问题,并且似乎与web服务器有关。我最近才在网络服务器上用Centos 6.5替换了旧版本的Ubuntu,在此之前我没有遇到过这个问题。此外,PHP代码与我切换之前相同,在此之前它没有给我带来这个问题。因此,我确信问题出在web服务器上,以及我在新系统上使用php或apache的一个设置上。

我在web服务器上编辑了/etc/php.ini,并将所有未注释的60秒时间限制(max_input_time、default_socket_timeout、mysql.connect_timeout)从60秒更改为600秒。60秒后,我仍然收到上述代理错误。

解决方案。

在(CentOS)web服务器上,编辑/etc/httpd/conf/httpd.conf

包括线路

ProxyPass       /appServer/  http://[private IP address]/ timeout=600 Keepalive=On

特别添加

timeout=600 Keepalive=On

部分。

为了安全起见,我还重新启动了apache。