In tomcat7, update the tomcat7/server.xml
. I installed tomcat7 in ubuntu so the directory is like below
ll /etc/tomcat7/
total 220
drwxr-xr-x 4 root root 4096 Oct 6 18:14 ./
drwxr-xr-x 136 root root 12288 Oct 6 16:12 ../
drwxrwxr-x 3 root tomcat7 4096 Sep 23 15:44 Catalina/
-rw-r--r-- 1 root tomcat7 6506 Jun 27 12:48 catalina.properties
-rw-r--r-- 1 root tomcat7 1394 Jan 25 2014 context.xml
-rw-r--r-- 1 root tomcat7 2370 Feb 18 2016 logging.properties
drwxr-xr-x 2 root tomcat7 4096 Sep 23 16:06 policy.d/
-rw-r--r-- 1 root tomcat7 6716 Oct 6 18:14 server.xml
-rw-r----- 1 root tomcat7 1607 Sep 23 15:50 tomcat-users.xml
-rw-r--r-- 1 root tomcat7 168099 Nov 25 2015 web.xml
You would see the connector section in the conf file etc/tomcat7/server.xml
,
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443"/>
Stop the tomcat and just add the maxPostSize
at the end,
sudo service tomcat7 stop
Update the connector in the server.xml,
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443"
maxPostSize="57000000"/>
Then restart the tomcat.
sudo service tomcat7 start
max-file-size
is still inweb.xml
as of Tomcat 8.0.20, set to 50MB as in Oscar Lopez's answer. – Pozsony