Question

I have set up a DMZ to run a web site. Most of the code is on an application server running Debian Release 7.0 (wheezy) 64-bit. I also have a web server running CentOS 6.5. It acts as a proxy for the application server. I have set up LAMP on both and my web pages are written in PHP. A PHP script on the web server calls a PHP script on the application server. The application server script calls a long running (> 1 minute) executable (that had been developed in C++). After 60 seconds (timed by my watch), the script fails with the following message.

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

I commented out code in the application server PHP script and narrowed the problem down to the long-running C++ executable. I also ran the executable in the shell without any problems. So there is clearly a time-out issue and it seems to be associated with the web server. I have only recently replaced an old version of Ubuntu, with Centos 6.5, on the web server and I did not have this problem before I did that. Also, the PHP code is the same as before I made the switch and it did not give me this problem prior to that. So I am convinced that the problem lies with something on the web server and one of the setting I have, with php or apache, on the new system.

I edited /etc/php.ini, on the web server, and changed all of the uncommented-out 60 second time limits (max_input_time, default_socket_timeout, mysql.connect_timeout) from 60 seconds to 600 seconds. I still get the above proxy error after 60 seconds.

Was it helpful?

Solution

Solution.

On the (CentOS) web server, edit /etc/httpd/conf/httpd.conf

Include the line

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

Specifically add the

timeout=600 Keepalive=On

part.

I also restarted apache to be on the safe side.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top