• notice
  • Congratulations on the launch of the Sought Tech site

recv() failed (104: Connection reset by peer) while reading response header from upstream

    I encountered this problem a few days ago.After studying for a period of time, I wanted to put it For a while, I will look at it again today.Still unsuccessful.The reason for this is this.I use curl in PHP to grab Taobao pages, and there is no problem in the local program.When I grab it on Alibaba Cloud, an nginx error will appear: [error] 30922#0: *32777 recv() failed (104: Connection reset by peer) while reading response header from upstream; in the error log of php-fpm:

Jul 21 16:49:31.210674 [WARNING] fpm_children_bury(), line 215: child 31025 (pool default ) exited on signal 11 SIGSEGV after 40.167434 seconds from start
Jul 21 16:49:31.211007 [NOTICE] fpm_children_make(), line 352: child 31038 (pool default) started
    Description The php-fpm process has been killed and then restarted.Modifying the configuration of nginx, modifying the configuration of php-fpm, such as: modifying the request_terminate_timeout parameter in php-fpm.conf, etc., does not work!.

& nbsp;   My program is like this.To crawl Taobao pages in PHP, because Taobao pages will be redirected 301, you need to set up when crawling: curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); but Once you execute this sentence and then crawl the page, nginx will return a 502 error, which is the above error log.Suspected that it was an error when grabbing https, so I modified the parameters of fastcgi: fastcgi_param  HTTPS $https if_not_empty; still not working.Various attemptsAfter, still unsuccessful,make a record.

-------------------------- ------------------------

    Postscript: After various attempts failed, I upgraded PHP from the old version php5.2.17 to PHP 5.3.28.The problem is solved.But the reason is still unknown! <


Technical otaku

Sought technology together

Related Topic


Leave a Reply