DEV Community

Aubrey Portwood
Aubrey Portwood

Posted on • Edited on

6

How I configured NIGINX + Valet to stop the 504 Gateway Time out during long XDebug Sessions

In this video I explain how to stop NGINX (installed via Valet) from 504 Gateway Time-out during long XDebug sessions.

By default this is set to 30 seconds, so if I was debugging something for longer than 30 seconds it would timeout and I would have to restart my xDebug session — annoying!

After doing some research, I finally figured out how to include an NGINX configuration file with these configurations:

proxy_connect_timeout 1200;

proxy_read_timeout 1200;
proxy_send_timeout 1200;

fastcgi_read_timeout 1200;
fastcgi_send_timeout 1200;
Enter fullscreen mode Exit fullscreen mode

Note, you can add these directly to /opt/homebrew/etc/nginx/nginx.conf before any Valet configs are loaded, e.g.:

    proxy_connect_timeout 1200;
    proxy_read_timeout 1200;
    proxy_send_timeout 1200;
    fastcgi_read_timeout 1200;
    fastcgi_send_timeout 1200;

    include "/Users/<user>/.config/valet/Nginx/*";
    include servers/*;
    include valet/valet.conf;
Enter fullscreen mode Exit fullscreen mode

...but I opted to use include and load a configuration file that way.

I also review some updates to my last video on my XDebug configuration and how I also configured PHP timeouts to also be higher.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs