Receiving 404 when uploading file larger than 10kb

Check the nginx error.log (based on nginx.conf error_log location).

$ sudo nano /path/to/nginx/error.log

There is a “permission denied” error on /var/lib/nginx. This happened because I changed the user setting in nginx.conf from

user nginx;

to something else. In this case,

user iam;

Solution:

Check the current user and group ownership on /var/lib/nginx.

$ ls -ld /var/lib/nginx
drwx------ 3 nginx nginx 4096 Aug  5 00:05 /var/lib/nginx

This tells you that a possibly non-existent user and group named nginx owns this folder. This prevents file uploading.

Change the folder ownership to the user defined in nginx.conf in this case iam (sudo may not be required).

$ sudo chown -Rf iam:iam /var/lib/nginx

Verify that it actually changed.

$ ls -ld /var/lib/nginx
drwx------ 3 iam iam 4096 Aug  5 00:05 /var/lib/nginx

The permission denied error should now go away. Check the error.log (based on nginx.conf error_log location).

$ sudo nano /path/to/nginx/error.log

If that doesn’t work you might need to reload nginx and php-fpm.

$ sudo service nginx reload
$ sudo service php-fpm reload