Nginx/Spring:增加上传文件尺寸限制

Nginx:

1. vi /etc/nginx/nginx.config

2. 在server中增加如下行

# set client body size to 20M #
client_max_body_size 20M;

3. 保存然后执行 nginx -s reload

 

Spring:

1. 修改spring-config.xml

2. 增加如下行

<!-- 上传解析 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- the maximum size of an uploaded file in bytes, 20M -->
<property name="maxUploadSize" value="20000000" />
</bean>
posted @ 2017-09-20 14:40  GreatK  阅读(331)  评论(0编辑  收藏  举报