This domain and all content is a copy of my old website, for historical purposes only.

This post is over a year old, its content may be outdated.

Matt Wilcox

Web Development

Notes Feb 07th 2015

Fixing file-upload hangs with nginx and Craft

A quick tip on how to fix things if your asset uploads in Craft seem to just hang.

If you're trying to upload a large file in Craft and you're running on nginx, you may find the Craft front end seems to fill the progress meter and then spin endlessly.

You likely already know to edit your php.ini file for this, but you also need to edit your site's nginx configuration; it defaults to a 1Mb maximum file size, and editing just php.ini is not enough to fix things.

Ensure that in your server block you have client_max_body_size set - if it's not there already, just add it, as below:

server {
  client_max_body_size 16M;
  ...
}

Of course, don't forget to edit your php.ini too, so it contains the following two lines too:

post_max_size = 16M
upload_max_filesize = 16M

You'll then need to restart nginx and php. On Debian, with it set up as in past tutorials on this site:

/etc/init.d/php5-fpm restart && /etc/init.d/nginx restart