dokku / dokku

A docker-powered PaaS that helps you build and manage the lifecycle of applications
https://dokku.com
MIT License
29.3k stars 1.92k forks source link

413 Request Entity Too Large #2917

Closed wootwoot1234 closed 7 years ago

wootwoot1234 commented 7 years ago

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?

josegonzalez commented 7 years ago

You need to replace myapp with your application's name in the instructions.

wootwoot1234 commented 7 years ago

@josegonzalez I should have said that, sorry. Yes, I used my app name not myapp and it's not working.

josegonzalez commented 7 years ago

Can you hop onto our slack chat room to get support? That will make debugging this issue for you much easier.

wootwoot1234 commented 7 years ago

@josegonzalez Sure, thanks. Do you have a link? I've never use slack but can sign up.

josegonzalez commented 7 years ago

http://dokku.viewdocs.io/dokku/getting-started/where-to-get-help/

josegonzalez commented 7 years ago

Problem was that the user customized their heroku app's nginx config but neglected to add the client_max_body_size 50M; to the config.

wootwoot1234 commented 7 years ago

@josegonzalez figured it out:

In my Procfile I have:

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

so in addition to my other configurations (see my first post) I had to add client_max_body_size 100m; to the top of nginx.conf, mine looks like this:

client_max_body_size 100m;
location / {
    index index.php;
    try_files $uri $uri/ /index.php$is_args$args;
}