(转)Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

 

Node应用,使用formidable处理文件上传,本地测试没有问题,部署到服务器上之后上传大文件浏览器收到以下错误信息:

Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

原因是服务器使用Nginx做代理而限制了上传文件的大小(默认为1M),修改Nginx配置:

 location / {
                        client_max_body_size  100M;
                        proxy_pass http://node_app;
}

在location 下面增加client_max_body_size 100M;配置项,重启Nginx文件上传成功.

 

posted @ 2021-01-05 15:26  TonyZhang24  阅读(668)  评论(0编辑  收藏  举报