if you are processing data with nginx and PHP-FPM, you might want to increase the following
“504 Gateway Timeout” is when nginx is waiting for a response from php-fpm for too long, you can fix that with
Increase PHP maximum execution time in /etc/php.ini: max_execution_time = 300
Increase PHP-FPM request terminate timeout in the pool configuration (/etc/php/8.2/fpm/pool.d/www.conf): request_terminate_timeout = 300
To disable all timeouts… you can add the following into any context, for serverwide, add anywhere in the http context (in /etc/nginx/nginx.conf)
keepalive_timeout 1d; send_timeout 1d; client_body_timeout 1d; client_header_timeout 1d; proxy_connect_timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; fastcgi_connect_timeout 1d; fastcgi_read_timeout 1d; fastcgi_send_timeout 1d; #memcached_connect_timeout 1d; #memcached_read_timeout 1d; #memcached_send_timeout 1d;
Increasing php fpm values
Before you change values in php.ini, you need to tweak nginx a bit, so you need to start by editing the nginx config file at /etc/nginx/nginx.conf, and at the bottom of the http block, you may want to do the following
client_max_body_size 150m;
client_body_timeout 120;
Now, the above should be higher than the php max upload and max post sizes, if you like, you can disable the nginx restriction by setting them to zero !
Now, go for your php file that you can find in a place such as (/etc/php/8.2/fpm) and edit the values, for example
upload_max_filesize = 150M
post_max_size = 150M
Once done, dont forget to restart both
systemctl restart php8.2-fpm
systemctl restart nginx