dokku:413 请求实体太大 [英] dokku: 413 Request Entity Too Large
问题描述
上传大于 1M 的文件时,我不断收到413 请求实体太大"错误.我按照此处的以下说明进行操作,但没有奏效.
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
我尝试更新我的 Procfile
,使用以下条目将 php.ini 文件添加到我的根目录,但它也没有帮助:
I tried updating my Procfile
adding a php.ini file to my root directory with the following entry but it also didn't help:
简介:
web: vendor/bin/heroku-php-nginx -C nginx.conf -i php.ini php/
php.ini:
upload_max_filesize = 100M
post_max_size = 100M
我做错了什么?无论如何要测试我的配置是否正在被使用或者它们是否被其他东西覆盖?我检查了 phpinfo();
并且正在使用这些设置,是否有与 nginx 等效的设置?
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?
有没有办法全局更改所有图像的 nginx 设置?
Is there a way to change the nginx settings globally for all images?
推荐答案
Dokku 的默认 nginx 配置将客户端最大主体大小限制为 1MB.
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
其中 node-js-app
是应用程序名称.请参阅 http:///dokku.viewdocs.io/dokku/configuration/nginx/#customizing-via-configuration-files-included-by-the-default-tem
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
这篇关于dokku:413 请求实体太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!