[英]How big a war file should be?
Tomcat 7 manager limit the war file size to 50 Mo. Tomcat 7经理将war文件大小限制为50 Mo.
I'm working with Grails 2.2 which generate a minimal WAR of 28 Mo. So, the limit of 50 Min is very easy to reach. 我正在使用Grails 2.2,它产生28 Mo的最小WAR。所以,50 Min的极限很容易达到。
This is only a limit set for you to upload and deploy via the Tomcat 7 manager. 这只是您通过Tomcat 7管理器上传和部署的限制。 There really is not a limit on the size of the war file you can deploy to a tomcat server.
您可以部署到tomcat服务器的war文件的大小没有限制。
Here is a link that can help you increase this upload size. 这是一个可以帮助您增加此上传大小的链接。
Quoted from link -- 引自链接 -
Go to the web.xml of the manager application (for instance it could be under /tomcat7/webapps/manager/WEB-INF/web.xml. Increase the max-file-size and max-request-size:
转到管理器应用程序的web.xml(例如,它可以在/tomcat7/webapps/manager/WEB-INF/web.xml下。增加max-file-size和max-request-size:
<!– 50MB max –>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
If you're using Tomcat 8, the max-file-size
is not in web.xml
anymore. 如果您使用的是Tomcat 8,则
max-file-size
不再位于web.xml
。 Instead, open conf/server.xml
and find the tag entry for the HTTP connector. 而是打开
conf/server.xml
并找到HTTP连接器的标记条目。 Then add the 然后添加
maxPostSize="0"
attribute and value to this tag. 此标记的属性和值。 When you have completed editing the
conf/server.xml
file, save it and restart Apache Tomcat. 完成编辑
conf/server.xml
文件后,保存并重新启动Apache Tomcat。
The 50 MB default file size limit is not hard-coded, you can change it in the web.xml
file of the Manager application of your webapp folder. 50 MB默认文件大小限制不是硬编码的,您可以在webapp文件夹的Manager应用程序的
web.xml
文件中更改它。 You'll have to increase the max-file-size
and max-request-size
: 您必须增加
max-file-size
和max-request-size
:
<!– 50MB max –>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
Replace the current values with the appropriate values for your needs. 将当前值替换为您需要的适当值。
Go to the web.xml of the manager application (for instance it could be under /tomcat7/webapps/manager/WEB-INF/web.xml
. 转到管理器应用程序的web.xml(例如,它可以在
/tomcat7/webapps/manager/WEB-INF/web.xml
下。
Increase the max-file-size and max-request-size to for example 100Mb 将max-file-size和max-request-size增加到例如100Mb
In tomcat7, update the tomcat7/server.xml
. 在tomcat7中,更新
tomcat7/server.xml
。 I installed tomcat7 in ubuntu so the directory is like below 我在ubuntu中安装了tomcat7,所以目录如下所示
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
, 你会在conf文件
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, 停止tomcat,最后添加
maxPostSize
,
sudo service tomcat7 stop
Update the connector in the server.xml, 更新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. 然后重启tomcat。
sudo service tomcat7 start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.