1. 程式人生 > >tomcat 伺服器部署

tomcat 伺服器部署

windows 系統 啟動tomcat 直接..\apache-tomcat-7.0.82\bin 下的  startup.bat,關閉 shutdown.bat

通過tomcat Manager 管理頁面部署時:

1.需要先修改tomcat-users 檔案 新增一個賬號和許可權

路徑:..\apache-tomcat-7.0.82\conf下面的 tomcat-users  下面是已經修改的了

<tomcat-users>
<role rolename="manager-gui"/>

<role rolename="manager-script"/>

<role rolename="manager-jmx"/>

<role rolename="manager-status"/>

<user roles="manager-gui,manager-script,manager-jmx,manager-status" password="admin" username="admin"/>

</tomcat-users>

2.進入tomcat首頁後 點選右邊的Manager App 進入Manager控制頁面,用剛才配置的使用者和密碼

3.如果war包大於50M需要修改 manger檔案下的web.xml檔案  

路徑:..\apache-tomcat-7.0.82\webapps\manager\WEB-INF 下的web.xml   下面是修改後的

<multipart-config>
      <!-- 預設最大是 50MB  -->
      <max-file-size>204857600</max-file-size>
      <max-request-size>204857600</max-request-size>
      <file-size-threshold>0</file-size-threshold>
</multipart-config>

 

修改域名訪問、不輸入埠、不輸入專案名稱直接進入

修改tomcat server.xml 檔案 

路徑:..\apache-tomcat-7.0.82\conf下面的server.xml  下面是已經修改的了

對應的埠號 改為80

<!-- port 改為80 啟動後可以不用輸入埠號即可進入-->
<Connector port="80" redirectPort="8443" connectionTimeout="20000" protocol="HTTP/1.1"/>
<!-- name 改成你自己的域名 -->
 <Host name="你自己的域名"  appBase="webapps"
      unpackWARs="true" autoDeploy="true">

	<!--啟動後不用輸入專案名稱可以直接進入-->
    <Context path="" docBase ="/你的專案名稱/"/>

      <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
          prefix="localhost_access_log." suffix=".txt"
          pattern="%h %l %u %t &quot;%r&quot; %s %b" />

 </Host>