Welcome! Log In Create A New Profile

Advanced

HTTP 499 timeouts. NginX and PHP-FPM

Posted by TFATM 
HTTP 499 timeouts. NginX and PHP-FPM
March 22, 2013 03:09PM
Hi everyone, I am hoping that someone on here can help me sovle this before I'm forced to move back to Apache where I know this just works.

I have a PHP script which can take a 3 minutes to execute and which runs fine from the command-line using php. however, when I trigger the script from a web page, I receive a HTTP 499 response within the nginx access logs 60 seconds after the request is made.

Reading around online I've made the following NginX config changes to try to force the server to run for more than 60 seconds:
- Within the location directive
fastcgi_send_timeout 1200;
fastcgi_read_timeout 1200;
fastcgi_connect_timeout 1200

- Within the server directive
client_header_timeout 1200;
client_body_timeout 1200;
keepalive_timeout 600;

On the PHP side, I've set the php-fpm config setting to include:

request_terminate_timeout = 1200s
request_terminate_timeout = 0

On the main PHP.ini side I've set:

max_execution_time = 1200
default_socket_timeout = 1200
mysql.connect_timeout = 1200

When I run a phpinfo() on the webserver I can see all of these PHP config settings have been picked up and yet still when I run the script I receive the HTTP/1.1 499 response after only 60 seconds.

The script has been successfully run against:
1. The PHP cli
2. The PHP-CGI cli
3. Apache 2.4.2

I'm running NginX 1.1.19 and PHP 5.4.11

I've exhausted everything I can think off, and all of my searches online turn up either unanswered questions or point to increasing the fast_cgi settings within the Nginx which I have done witihn the sites-enabled/ config.

Sadly if I can't find a solution soon, I will have to ditch NginX for this project, so any help would be greatly appreciated
Re: HTTP 499 timeouts. NginX and PHP-FPM
March 22, 2013 03:46PM
As an update I created a simple test file

<?php
sleep(70);
echo 'hello';
?>

When accessing the page the 499 response error is generated.
Re: HTTP 499 timeouts. NginX and PHP-FPM
March 25, 2013 02:15PM
The problem turned out to be the AWS ELB terminating connections after 60 seconds of being idle
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 219
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready