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

1.若nginx用所用的 php 请求解析服务是 fpm, 则检查 /etc/php5/fpm/php.ini 文件中的参数

upload_max_filesize = 20M
post_max_size = 20M

重启fpm服务

service php5-fpm restart

然后上传20M以内的文件,若仍出现 413 错误,则排除 php.ini 的问题

2.在 /etc/nginx/sites-enabled/xxxx 网站配置中加入下面字段

 
  1. server {

  2. ...

  3. client_max_body_size 20m;

  4. ...

  5. }

重启nginx服务

service nginx restart

问题解决!

猜你喜欢

转载自blog.csdn.net/qq_19004627/article/details/81323296