上传文件错误 413 (Request Entity Too Large),413entity
上传文件错误 413 (Request Entity Too Large),413entity
1、nginx 服务器反向代理配置上错误
修改配置文件
#vim /usr/local/openresty/nginx/conf/nginx.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
client_max_body_size 20m; #允许最大上传文件大小,默认情况下,该指令值为1m。
}
此指令设置NGINX能处理的最大请求主体大小。 如果请求大于指定的大小,则NGINX发回HTTP 413(Request Entity too large)错误。 如果服务器处理大文件上传,则该指令非常重要。
2、spring boot 2配置上传文件
spring:
servlet:
multipart:
enabled: true # Whether to enable support of multipart uploads.
max-file-size: 10MB # 单个文件大小
max-request-size: 100MB #总上传的数据大小
评论暂时关闭