8、附件下载限制问题
1、springboot设置下载大小
在application.yml中设置文件的大小
spring:
profiles:
active: dev
servlet:
multipart:
enabled: true
max-file-size: 300MB
max-request-size: 300MB
2、war包的话,需要在tomcat设置
maxPostSize tomcat6 是 1 ,tomcat 6 以上是-1 不限制文件大小
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
maxPostSize="-1"
redirectPort="8443" />
3、nginx 反向代理的话,需要设置
server {
listen 80;
#server_name localhost;
client_max_body_size 500M;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass https://127.0.0.1:8080/;
}
}
4、如果用了springMvc的,在这里设置
<``bean` `id``=``"multipartResolver"` `class``=``"org.springframework.web.multipart.commons.CommonsMultipartResolver"` `p:defaultEncoding``=``"UTF-8"``>
``<``property` `name``=``"maxUploadSize"` `value``=``"524288000"` `/>
``<``property` `name``=``"maxInMemorySize"` `value``=``"4096"` `/>
</``bean``>
5、如果使用了国产化的代理服务器的话,(我这里用的是金蝶)
setMaxUploadSize 这个方法里面设置
@Bean(name="multipartResolver")
public MultipartResolver multipartResolver(){
CommonsMultipartResolver resolver = new CommonsMultipartResolver();
resolver.setDefaultEncoding("UTF-8");
resolver.setResolveLazily(true);
resolver.setMaxInMemorySize(40960);
//文件下载改成500M
resolver.setMaxUploadSize(500*1024*1024);
return resolver;
}