Hi, dalecosp! Thank you for the reply; I really appreciate it.
I tried increasing both send_timeout and fastcgi_read_timeout from their default values of 60s to 300s. The behavior is the same, essentially; the only difference now is that the CGI output that I pasted in my initial post hangs for 5 minutes instead of 1 before ultimately timing-out.
I should add that I'm requesting a very simple script via cURL; in Apache, the server responds within a matter of milliseconds. So, it's not as though I'm calling a long-running script.
Oh wait, here we go! I just started commenting-out calls to curl_setopt() and when I commented-out the following two lines, I at least got some output:
//Turn off the server and peer verification (TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
With those two lines commented-out, my script outputs "false" (I'm var_dump()-ing the result of curl_exec()), which is what I would expect if peer or host verification failed (and it seems to).
I tried my script in Apache, with the same two lines commented-out, and the result is the same: "false".
Here are the results from a series of tests with the various combinations of options, under each Web-server:
Apache:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
Script returns expected result.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
Script returns "false".
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
Script returns "false".
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
Script returns expected result.
NGINX:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
NGINX returns "504 Gateway Time-out".
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
Script returns "false".
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
Script returns "false".
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
NGINX returns "504 Gateway Time-out".
According to the PHP manual ( http://php.net/manual/en/function.curl-setopt.php ), both of these options are set to their "most secure values" (my term) by default. CURLOPT_SSL_VERIFYPEER = 1 (perform the verification) and CURLOPT_SSL_VERIFYHOST = 2 (check the existence of a common name and also verify that it matches the hostname provided).
I do realize that I am setting CURLOPT_SSL_VERIFYHOST to bool true when the value should be 1 or 2, but this doesn't seem to affect the problem behavior.
Any thoughts on this new information?
Thanks again!