Skip to content

Instantly share code, notes, and snippets.

@lform-design
Created March 27, 2020 18:25
Show Gist options
  • Select an option

  • Save lform-design/7e9a36bfec1063aca6615e14d603a727 to your computer and use it in GitHub Desktop.

Select an option

Save lform-design/7e9a36bfec1063aca6615e14d603a727 to your computer and use it in GitHub Desktop.
Fixing 502 Bad Gateway Errors on Valet with Nginx

Fixing 502 Bad Gateway Errors on Valet with Nginx

This error is usually caused by AJAX calls, and is due to there being too much data in the request for Nginx to process with its current settings.

  1. Create ~/.config/valet/nginx/all.conf with the following:

     proxy_buffer_size 4096k;
     proxy_buffers 128 4096k;
     proxy_busy_buffers_size 4096k;
    
  2. Append the following to /usr/local/etc/nginx/fastcgi_params

     fastcgi_buffer_size 4096k;
     fastcgi_buffers 128 4096k;
     fastcgi_busy_buffers_size 4096k;
    
  3. Restart valet as both Nginx and PHP-FPM must be restarted for these settings to take effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment