[英]How big a war file should be?
Tomcat 7經理將war文件大小限制為50 Mo.
我正在使用Grails 2.2,它產生28 Mo的最小WAR。所以,50 Min的極限很容易達到。
這只是您通過Tomcat 7管理器上傳和部署的限制。 您可以部署到tomcat服務器的war文件的大小沒有限制。
這是一個可以幫助您增加此上傳大小的鏈接。
引自鏈接 -
轉到管理器應用程序的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>
如果您使用的是Tomcat 8,則max-file-size
不再位於web.xml
。 而是打開conf/server.xml
並找到HTTP連接器的標記條目。 然后添加
maxPostSize="0"
此標記的屬性和值。 完成編輯conf/server.xml
文件后,保存並重新啟動Apache Tomcat。
50 MB默認文件大小限制不是硬編碼的,您可以在webapp文件夾的Manager應用程序的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>
將當前值替換為您需要的適當值。
轉到管理器應用程序的web.xml(例如,它可以在/tomcat7/webapps/manager/WEB-INF/web.xml
下。
將max-file-size和max-request-size增加到例如100Mb
在tomcat7中,更新tomcat7/server.xml
。 我在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
你會在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"/>
停止tomcat,最后添加maxPostSize
,
sudo service tomcat7 stop
更新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"/>
然后重啟tomcat。
sudo service tomcat7 start
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.