Nginx 413 Request Entity Too Large

Using: nginx version: nginx/1.2.4

I manage a few Linode instances as client servers but I would far from consider myself a sysadmin. I received an email from a client regarding some uploading issues. After some testing I concluded any combination of files over 1mb would raise Nginx 413 Request Entity Too Large

I upped the file limit within the virtualhost file by changing the client_max_body_size

upstream app {
  server unix:/tmp/app.sock fail_timeout=0;
}

server {
  listen  80;

  location / {
    proxy_pass      http://app;
    proxy_redirect  off;

    client_max_body_size 6m;
  }
}

This still did not work. After more web browsing I tried moving the client_max_body_size outside the location block.

upstream app {
  server unix:/tmp/app.sock fail_timeout=0;
}

server {
  listen  80;

  client_max_body_size 6m;

  location / {
    proxy_pass      http://app;
    proxy_redirect  off;
  }
}

This achieved the desired result! After some more testing I could upload to the new max limit.

TLDR: Moved client_max_body_size outside of the location block into the server block.