Skip to content

Changing Execution Time Limits and Webserver Proxy Timeouts

Don’t let inefficient code eat up all your RAM. Time limits save your webserver (Apache or Nginx) resources from being tied up by code that takes too long to execute.

The default limits that are built into the platform will suit most cases, but you can change them, or avoid them entirely by running scripts without involving the webserver.

Default Timeouts and Execution Time Limits

  • The default webserver proxy timeout is 60 seconds.
  • When scripts are executed through a webserver, the default max_execution_time is 30 seconds.

You can change both of these limits, but we don’t recommend extending them too far. It’s a good idea to keep these times as low as you practically can.

How to Change the Webserver Proxy Timeout

By default, the webserver proxy timeout is set to 60 seconds. Most webpages should return results in much less than a minute, and most of the container images that we supply take advantage of the FastCGI Process Manager (FPM). So, usually, 60 seconds will be plenty of time.

The way to change this time depends on whether your container is running an Nginx or Apache image.


  • Configuration file: /container/config/apache2/sites-enabled/000-default.conf
  • Directive: ProxyTimeout


  • Configuration file: /container/config/nginx/sites-available/default
  • Directive: proxy_read_timeout and fastcgi_read_timeout

After you’ve made your changes, restart the container for them to take effect.

How to Change the Webserver’s Maximum Execution Time

If you need a longer max_execution_time than the default of 30 seconds, or you want to enforce a shorter time, this takes a change to your container configuration.

The file to edit is php.ini. For default web images, the file location is /container/config/php/php.ini.

After you’ve made your changes, restart the container for them to take effect.

Nginx: To raise the maximum execution time over 60 seconds, you’ll need to raise a support ticket after you’ve edited the container configuration. That’s because we need to make equivalent changes to Nginx reverse-proxy handling that’s used for incoming requests to the server.

Use the Command Line to Avoid the Webserver

Some scripts you know will take longer than 30 or 60 seconds. You can isolate long-running tasks from the webserver and its timer by executing them via the command line.

Taking PHP scripts as an example, you can run them over the command line when connected to the container via SSH. The command would look like this:

php /container/application/script.php

When you run PHP scripts from the command line like this, there’s no execution time limit.

Cron Jobs Automate These Scripts

By setting up cron jobs you can automate these tasks. Then they’ll execute themselves via the command line, on a schedule that you decide.