Nginx – 504 timeout no matter how much I increase timeout parameters

nginxtimeout

I've tried increasing timeout values in the /usr/local/etc/nginx/valet/valet.conf file:

server {
    listen 80 default_server;
    root /;
    charset utf-8;
    client_max_body_size 500M;
    client_header_timeout 3000;
    client_body_timeout 3000;

    location /41c270e4-5535-4daa-b23e-c269744c2f45/ {
        internal;
        alias /;
        try_files $uri $uri/;
    }

    location / {
        rewrite ^ /Users/Me/.composer/vendor/laravel/valet/server.php last;
    }

    access_log off;
    error_log /Users/Me/.valet/Log/nginx-error.log;

    error_page 404 /Users/Me/.composer/vendor/laravel/valet/server.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/Users/Me/.valet/valet.sock;
        fastcgi_index /Users/Me/.composer/vendor/laravel/valet/server.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /Users/Me/.composer/vendor/laravel/valet/server.php;
        fastcgi_read_timeout 3000;
        fastcgi_send_timeout 1200;
        fastcgi_connect_timeout 1200;
        fastcgi_buffers 32 64k;
        fastcgi_buffer_size 128k;
        proxy_connect_timeout 3000;
        proxy_send_timeout 3000;
        proxy_read_timeout 3000;
        send_timeout 3000;
    }

    location ~ /\.ht {
        deny all;
    }
}

Tried adding request_terminate_timeout = 3000 to php.ini and increasing the following values:

max_input_time = 900
max_execution_time = 900

This is in the php.ini file which shows from php --ini:

/usr/local/etc/php/7.2/php.ini

I've restart php and nginx.

I still get timed out at 30 seconds.

What am I missing here?

Best Answer

The problem was caused by the fact that Laravel Valet creates a separate conf file under ~/.valet/Nginx/yoursite.conf after doing valet secure on a directory.

Adding the timeout changes to that conf file and then restarting valet fixed the issue.

Related Topic