Heroku Nginx HTTP 413实体太大了

上传4MB文件时收到错误413.我已经在public /文件夹上创建了一个.user.ini文件.允许最多10 MB的文件

所以我在我的nginx.conf上使用了client_max_body_size,但我仍然得到413.

location / {
    index index.php;
    try_files $uri $uri/ /index.php?$query_string;
    client_max_body_size 10M;
}

那个配置是​​因为我使用的是Laravel 5.

这是我的Procfile

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

我做错什么了吗?

最佳答案
也许有点晚了,但为了解决这个问题,请移动你的client_max_body_size 10M;在位置部分之外.像这样:

client_max_body_size 10M;

location / {
    index index.php;
    try_files $uri $uri/ /index.php?$query_string;
}

有关heroku如何包含此文件的参考,请参阅https://github.com/heroku/heroku-buildpack-php/blob/beta/conf/nginx/heroku.conf.php#L35.

相关文章

文章浏览阅读3.7k次,点赞2次,收藏5次。Nginx学习笔记一、N...
文章浏览阅读1.7w次,点赞14次,收藏61次。我们在使用容器的...
文章浏览阅读1.4k次。当用户在访问网站的过程中遇到404错误时...
文章浏览阅读2.7k次。docker 和 docker-compose 部署 nginx+...
文章浏览阅读1.3k次。5:再次启动nginx,可以正常启动,可以...
文章浏览阅读3.1w次,点赞105次,收藏182次。高性能:Nginx ...