title: configure nginx to redirect on file too big (413)
body: <p>My environments :<br/>
  - Backend application running with Symfony 2<br/>
  - Nginx 1.8.0<br/>
  - Centos 6.5<br/>
  - php-fpm<br/></p>
  
  <p>Here is my nginx conf :<br/></p>
  
  <pre><code>server {
      listen 443;
      server_name demo.example.com;
      root /usr/share/nginx/html/crowdfunding/web;
  
      ssl on;
      ssl_certificate /etc/nginx/ssl/xxxxx.crt;
      ssl_certificate_key /etc/nginx/ssl/xxxxx.key;
  
      recursive_error_pages off;
      error_page 413 = $uri/413;
  
      error_log /var/log/nginx/example_error.log;
      access_log /var/log/nginx/example_access.log;
  
      location / {
          try_files $uri /app.php$is_args$args;
      }
  
  
      # PROD
      location ~ ^/app\.php(/|$) {
          internal;
          fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
          fastcgi_split_path_info ^(.+\.php)(/.*)$;
          fastcgi_index  index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param HTTPS on;
          fastcgi_intercept_errors on;
      }
  }
  </code></pre>
  
  <p>I have a page with an upload file input : <a href="http://demo.example.com/fr/member/edit" rel="nofollow">http://demo.example.com/fr/member/edit</a>
  The maximum size that i want is 500ko for this image
  When i try to upload a 2Mo file i have this error in my error file "client intended to send too large body"
  then you can see on the web browser corner the upload running, when it achieve the 100% is redirect to demo.example.com/fr/member/edit
  and restart to upload ... until nginx prompt error (may be about time process)</p>
  
  <p>What i would like :<br/>
  When nginx detect this : "client intended to send too large body" then stop uploading the file and redirect to <a href="http://demo.example.com/fr/member/edit/413" rel="nofollow">http://demo.example.com/fr/member/edit/413</a> (this is a route that should go into #prod)
  I just want to redirect a 413 to an other page of my application with nginx</p>
  
  <p>Thanks for your help and ask me if you need more informations.</p>
  
  <p><strong>Update 1 :</strong>
  Here my symfony 2 form</p>
  
  <pre><code>$builder-&gt;add('image', 'file', array('label' =&gt; 'general.image', 'required' =&gt; false, 'constraints' =&gt; array(
              new File(array(
                  'maxSize' =&gt; '500k',
                  'mimeTypes' =&gt; array(
                      'image/png',
                      'image/jpeg',
                      'image/pjpeg',
                      'image/gif',
                      'image/bmp',
                  )
              ))
          )));
  </code></pre>
  
  <p><strong>Update 2:</strong>
  In my php.ini i set this:</p>
  
  <pre><code>upload_max_filesize = 500k
  post_max_size = 500k
  </code></pre>