fastcgi configuration:
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
keepalive_timeout 65;
-sharptcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
main running php file:
curl_setopt_array($curl, array(
CURLOPT_URL =>$url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER=>false,
CURLOPT_SSL_VERIFYHOST=>false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"content-type: image/jpeg; charset=UTF-8"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
header("Content-type:text/html;charset=utf-8");
echo "cURL Error -sharp:" . $err;
} else {
echo $response;
}
unset($response);
unset($curl);
nginx error message:
2018/05/03 01:28:47 [error] 4832-sharp4936: *2045 upstream timed out (10060:
A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond) while connecting to upstream, client:
113.101.171.150, server: localhost, request:
"GET /log.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.5211.me"
when initiating a http request: return status cancle status