Nginx – AWS EC2, Ubuntu: upstream timed out (110: Connection timed out) while reading response header from upstream

amazon ec2amazon-web-servicesnginxubuntu-14.04

I have a lot of this NGINX error on several EC2 instances:

2016/10/28 15:50:46 [error] 2879#0: *31351 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.0.0.74, server: www.myhost.com, request: "POST /someurl HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock", host: "www.myhost.com", referrer: "https://www.myhost.com/other-url"

I don't know where investigate…
Nginx ? AWS ?

Best Answer

I'd also look into the fastcgi_read_timeout option.

fastcgi_read_timeout 150; (for example) in your nginx configuration block which could start with:

location ~* .php$ {...