10

Nginx 出现"413 Request Entity Too Large"的解决方法

 2 years ago
source link: https://uzbox.com/tech/linux/nginx413.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Nginx 出现

Nginx 出现"413 Request Entity Too Large"的解决方法

nginx 出现413 Request Entity Too Large问题的解决方法

使用php上传图片(大小1.9M),出现 nginx: 413 Request Entity Too Large 错误。

根据经验是服务器限制了上传文件的大小,但php默认的文件上传是2M,应该不会出现问题。

打开php.ini,把 upload_max_filesize 和 post_max_size 修改为20M,然后重启。

再次上传,问题依旧,可以排除php方面的问题。

原来nginx默认上传文件的大小是1M,可nginx的设置中修改。

解决方法如下:

1.打开nginx配置文件 nginx.conf, 路径一般是:/etc/nginx/nginx.conf。

2.在http{}段中加入:

client_max_body_size 20m;

20m为允许最大上传的大小。

3.保存后重启nginx,问题解决。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK