Nginx PHP Gotchas

Here are some changes I needed to make to my Nginx conf that didn’t seem obvious to me and will hopefully be of help to others:

Random 502 gateway errors

fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;

413 Request Entity Too Large

This is caused because by default file uploads are limited to 1mb.

server {
    client_max_body_size 20M;