nginx上传错误413 Request Entity Too Large

凉白开 Nginx427,0956字数 296阅读0分59秒阅读模式

默认情况下使用nginx反向代理上传超过2MB的文件,会报错413 Request Entity Too Large,解决这个方法很简单,修改配置client_max_body_size值即可

修改nginx.conf

#cat /usr/local/nginx-1.7.0/conf/nginx.conf | grep client_max_body_size
 client_max_body_size 10M;

如果需要上传更大的文件,那么client_max_body_size改成更大的值即可,这边改成了10MB文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-413-request-entity-too-large/

重启nginx

 # /usr/local/nginx-1.7.0/sbin/nginx -s reload
文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-413-request-entity-too-large/文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-413-request-entity-too-large/
weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
凉白开
  • 本文由 发表于 14/07/2014 01:00:10
  • 转载请务必保留本文链接:https://www.ttlsa.com/nginx/nginx-413-request-entity-too-large/
  • Apache
  • client_max_body_siz
  • Linux
  • nginx
  • nginx配置
评论  4  访客  4
    • Aceslup
      Aceslup 9

      memory_limit 不需要设置吧?

      • 牧童Damian
        牧童Damian 9

        mark

        • 默北
          默北 6

          还需要修改php上传文件大小限制
          ;This sets the maximum amount of memory in bytes that a script is allowed to allocate
          memory_limit = 32M
          ;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 = 10M

        评论已关闭!