通过Forge增加upload_max_filesize

Don*_*nie 4 amazon-web-services laravel forge

错误:413请求实体太大

我试图增加upload_max_filesize20M使用Edit PHP FPM ConfigurationEdit PHP CLI Configuration在Laravel锻造工具.它成功保存了我的设置,但更改似乎没有生效.我试过重启nginx和服务器.

环境:

  • AWS EC2
  • nginx的

Lor*_*ley 12

正如@dave-alvarez 所提到的,Laravel Forge 中有一个设置可以做到这一点。

  • 选择您的服务器并从左侧菜单中选择 PHP。
  • 最大文件上传大小设置为兆字节整数(无尾随单位)。
  • 通过转到页面底部并单击文件下拉菜单、编辑 PHP FPM 配置选项来确认您的更改。您可以搜索php.iniupload_max_filesize

在此处输入图片说明

在此处输入图片说明


Dav*_*rez 8

正在更新,因为这是该主题搜索的第一个搜索引擎结果:

Forge现在具有内置设置,您可以通过转到服务器详细信息页面,然后从左侧菜单中单击PHP进行更新。您会看到一个表格,用于更改最大文件大小。


Don*_*nie 7

我错过了一块.这是完整的答案.

Nginx配置

将以下行添加到http服务器位置上下文以增加nginx.conf中的大小限制:

# set client body size to 20M #
client_max_body_size 20M;
Run Code Online (Sandbox Code Playgroud)

PHP配置

编辑php.ini并设置以下指令:

;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 256M

;The maximum size of an uploaded file.
upload_max_filesize = 20M

;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 30M
Run Code Online (Sandbox Code Playgroud)

资料来源:http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/