关于php进行post出现500的超时问题解决办法

   最近搞个项目使用php进行post请求,时间长了就会出现500错误,ngnix报了个错误:

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 reading response header from upstream

  所以总算找到了办法:

首先:找到php的配置文件里面,开启:php_socket

php_socket

  然后查找下:timeout,并把值改为240

接着,打开ngnix的配置文件,把相应的时间改大,都改为240

最后找到站点的ngnix的配置文件

fastcgi_read_timeout 600;

完整的例如:

        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;
            fastcgi_read_timeout 600;
            include        fastcgi_params;
        }

 

posted @ 2024-01-24 21:19  圆柱模板  阅读(282)  评论(0编辑  收藏  举报