Upload filesize limit and nginx

If you’re trying to upload a file to a server running nginx and you’re getting some weird errors, check this. By default nginx only lets you have file uploads that are a max of two megs before it gives up. It will return something like “413: Entity too large.” When that happens head over to your nginx.conf file (or whichever config file contains your server directive) and add the following:

server {
  listen 80;
  server_name mycomain.com;
  root /var/www/myapp/public;

  client_max_body_size 10M;

That directive would now tell nginx to allow a ten megabyte upload. Modify to your liking!