Skip to main content
Luxian's Notes

Main navigation

  • Home
User account menu
  • Log in

Breadcrumb

  1. Home

nginx

By luxian, 7 December, 2016

How to increase timeout for nginx and php7.0-fpm in Ubuntu

PHP FPM timeout settings

To increase PHP timeout, you have to edit /etc/php/7.0/fpm/php.ini and change/add this:

max_execution_time = 300

For FPM you need to change /etc/php/7.0/fpm/pool.d/www.conf as well and change/add this:

php_admin_value[max_execution_time] = 300

There is also another option in the www.conf file names request_terminate_timeout, I didn't change that one because documentation says it should be used only the max_execution_time doesn't stop the script execution.

Next step, restart fpm:

service php7.0-fpm restart

nginx timeout settings

Edit your server configuration file, usually placed in /etc/nginx/sites-available/example.com, and in the cgi section add:

fastcgi_read_timeout 300;

And then restart nginx:

service nginx reload

In case you are using nginx as a proxy to something else, you can find instructions in this article: How to Fix 504 Gateway Timeout using Nginx.

Tags

  • nginx
  • php-fpm
  • ubuntu
  • how to
nginx

Pages

  • Contact
  • My tech
  • Wishlist
RSS feed
Powered by Drupal