4

I keep getting the "413 Request Entity Too Large" error when uploading files that are larger than 1M. I followed the following instructions from here but it didn't work.

mkdir /home/dokku/myapp/nginx.conf.d/
echo 'client_max_body_size 50M;' > /home/dokku/myapp/nginx.conf.d/upload.conf
chown dokku:dokku /home/dokku/myapp/nginx.conf.d/upload.conf
service nginx reload

I tried updating my Procfile adding a php.ini file to my root directory with the following entry but it also didn't help:

Procfile:

web: vendor/bin/heroku-php-nginx -C nginx.conf -i php.ini php/

php.ini:

upload_max_filesize = 100M
post_max_size = 100M

What am I doing wrong? Is there anyway to test if my configurations are being used or if they are being overwritten by something else? I checked phpinfo(); and those setting are being used, is there an equivalent to that for nginx?

Is there a way to change the nginx settings globally for all images?

Dev01
  • 13,292
  • 19
  • 70
  • 124
  • 1
    what do nginx log say? And possible for you to check if nginx had that setting applied by running `nginx -T` on the machine where nginx is running – Tarun Lalwani Sep 28 '17 at 19:29

1 Answers1

14

Dokku's default nginx config limits the client max body size to to 1MB.

You can reconfigure this by:

mkdir /home/dokku/node-js-app/nginx.conf.d/
echo 'client_max_body_size 50m;' > /home/dokku/node-js-app/nginx.conf.d/upload.conf
chown dokku:dokku /home/dokku/node-js-app/nginx.conf.d/upload.conf
service nginx reload

Where node-js-app is the app name. See http://dokku.viewdocs.io/dokku/configuration/nginx/#customizing-via-configuration-files-included-by-the-default-tem

frmdstryr
  • 20,142
  • 3
  • 38
  • 32