Hello,
I have a fairly simple PHP script that I have used in the past, under
Apache, to “simulate an HTTP form POST”.
For some reason, when I attempt to do the same under nginx, the browser
hangs until some timeout is reached, at which point nginx returns a “504
Gateway Timeout” response to the browser.
This could very well be a PHP problem (or configuration issue) and have
nothing to do with nginx, in which case I am happy to take this
discussion to the appropriate list. But this does work as expected under
Apache, running PHP as a module.
If I enable verbose cURL output in PHP, all of the output is sent to the
instance of cmd.exe (the Windows console) in which PHP’s “php-cgi.exe”
is running. This enables me to see that nginx is indeed handling the
request. Here is the output:
- About to connect() to ben-pc port 443 (#0)
- Trying fe80::1ddc:6806:70b6:8546…
- Connection refused
- Trying fe80::61f9:7669:a282:252d…
- Connection refused
- Trying 169.254.37.45…
- connected
- Connected to ben-pc (169.254.37.45) port 443 (#0)
- SSL connection using DHE-RSA-AES256-SHA
- Server certificate:
-
[redacted]
-
start date: 2013-07-05 18:17:36 GMT
-
expire date: 2014-07-05 18:17:36 GMT
-
[redacted]
-
SSL certificate verify result: self signed certificate (18),
continuing
anyway.
- Server auth using Basic with user ‘me’
POST /myproject/trunk/public/jsapi/api-router/ HTTP/1.1
Authorization: Basic [redacted]
Host: ben-pc
Accept: /
Content-Length: 85
Content-Type: application/x-www-form-urlencoded
- upload completely sent off: 85 out of 85 bytes
< HTTP/1.1 504 Gateway Time-out
< Server: nginx/1.5.2
< Date: Mon, 05 Aug 2013 22:28:06 GMT
< Content-Type: text/html
< Content-Length: 182
< Connection: keep-alive
< - Connection #0 to host ben-pc left intact
- Closing connection #0
If I disable verbose cURL output (using curl_setopt($ch,
CURLOPT_VERBOSE, 1) no output is sent to the console, and the same
timeout and 504 response occurs.
My setup is essentially the same as that described at
PHP-FastCGI on Windows | NGINX .
Is there a simple solution to this? I’m surprised by the dearth of
search results for “nginx php-cgi curl 504”, given that my stack
configuration is relatively untouched.
I should mention that all other PHP behavior seems normal; the server is
definitely “functional” in every other way.
I am happy to post details of my nginx installation, PHP configuration,
script source code, etc. if any of it would be helpful.
Thanks for any pointers,
-Ben