Categories
Development Internet

WP Migrate DB Pro + Vagrant – 502 errors

I’ve been using WP Migrate DB Pro and Vagrant for some time, but there has always been one aspect that has really annoyed me: when pulling from a remote server to my local environment, Media downloads would (very) often fail due to a 502 timeout.

I had always assumed it was an error on the remote server, until one day I was reading through my local log files (as one does) and stumbled across a Nginx configuration change that made everything work as it should.

I should note that my configuration uses Nginx and PHP-FPM, and it’s the configuration of the latter which is where the tweak needs to be made:

location ~ \.php$ {
	...

	fastcgi_buffers 16 16k;
	fastcgi_buffer_size 32k;

	...
}

https://stackoverflow.com/questions/46205725/nginx-502-fastcgi-error

Where you configure how PHP files are handled, be sure to increase the buffers and buffer size — the defaults are too small to handle the amount of data downloaded by WP Migrate DB Pro.

With this simple change, I can finally work locally with WordPress and be sure my files are in sync with the remote server.