1、错误数据
<html>
<head>
<title>413 Request Entity Too Large</title>
</head>
<body>
<center>
<h1>413 Request Entity Too Large</h1>
</center>
<hr>
<center>nginx/1.16.1</center>
</body>
</html>
2、问题原因
2.1、服务器架构
nginx反向代理到tomcat。而nginx默认上传传文件的大小限制是1M
2.2 nginx反向代理配置
location ^~ /cc-fc {
proxy_pass http://127.0.0.1:8172/cc-fc;
}
2.3、代码中配置
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
3、解决方式
- 打开nginx服务的配置文件:vim nginx.conf
- 如下图: 加入client_max_body_size 10m;
- 保存后重启nginx:sbin/nginx -s reload 。