Nginx Timeout: Configuration

Resolve timeout problems with Nginx.

Nginx often acts as a reverse proxy in front of PHP-FPM, Node.js or other backends. If the backend is too slow, Nginx returns a 504 Gateway Timeout error. Here's how to configure correctly.

Symptoms

Common Causes

Diagnostic Steps

  1. Check Nginx logs (error.log)
  2. Test direct backend access (curl localhost:9000)
  3. Examine current timeout values
  4. Verify PHP-FPM is running (systemctl status php-fpm)

Automate with MoniTao

MoniTao detects timeouts:

Best Practices

FAQ

What timeout directives in Nginx?

proxy_connect_timeout, proxy_send_timeout, proxy_read_timeout, fastcgi_read_timeout.

What default value?

60 seconds by default. Adjust according to your longest operations.

How to increase for uploads?

Use client_max_body_size and increase timeouts in the concerned location.

Can MoniTao test with long timeouts?

Yes, configure the timeout in monitor settings.

Ready to Sleep Soundly?

Start free, no credit card required.