413 请求实体太大 - 文件上传问题

新手上路,请多包涵

我正在尝试在我的服务器上上传 30MB 的文件,但它无法正常工作。

  1. 当我上传 30MB 文件时,页面加载“ 页面未找到

  2. 当我上传 3MB 文件时,我收到带有 nginx/0.6.32 的“ 413 Request Entity Too Large

我正在尝试查找 nginx,以便增加“ client_max_body_size ”,但我无法在我的服务器上找到安装的 nginx。我什至尝试运行:

 vi /etc/nginx/nginx.conf

或者

vi /usr/local/nginx/conf/nginx.conf

检查配置文件是否存在,但我在我的服务器上找不到它。

有没有办法解决这个问题?或者我必须在我的服务器上安装 nginx。

编辑:

我已经在我的 php.ini 文件中进行了所有必要的更改,

 post_max_size 128M
upload_max_filesize 100M
memory_limit 256M

谢谢,拉朱

原文由 Raju Vishwas 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 336
1 个回答

只需打开此文件并 —

 sudo vim  /etc/nginx/nginx.conf

httpserverlocation 部分添加一行:

 client_max_body_size 100M;

然后通过以下命令检查 nginx 是否正常

sudo nginx -t

如果一切看起来都很好,那么你会得到

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

然后重启nginx

 sudo systemctl restart nginx

我希望你的目的得到满足:)

原文由 Md.Imam Hossain Roni 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题