tomcat上传文件过大(无法上传)
网络环境 nginx+tomcat
nginx设置
nginx中 client_max_body_size这个参数限制了上传文件的大小,默认是1M
location / {
root /data/ceshi;
index loading index.html index.htm index.jhtml;
proxy_pass http://java_pool;
client_max_body_size 1000m; //修改为1000M
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
tomcat设置
找到里面的<Connector>标签,添加"maxPostSize"属性,将该属性值设置成你想要的最大值,单位是字节,或者把这个值设置为 0(maxPostSize="0"),tomcat就不再检查POST的大小
conf/server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
maxPostSize="0"
redirectPort="8443" />
在bin/catalina.sh的前面,加
JAVA_OPTS='-server -XX:NewSize=256m -XX:MaxNewSize=512m'
It may have the strength, but the effort, struggle, worthy of the heart.

浙公网安备 33010602011771号