tomcat下訪問Web專案
阿新 • • 發佈:2019-01-29
1.不需要資料專案名稱就可以訪問專案的配置方法如下:
首先到你的Tomcat下的conf資料夾下找到server.xml檔案,開啟後修改為:
- <Host name="localhost" appBase="webapps"
- unpackWARs="true" autoDeploy="true"
- xmlValidation="false" xmlNamespaceAware="false">
- <Context path="" docBase="reportSystem" debug="0" reloadable="true"/>
上面的:reportSystem就是你在webapps下面部署的專案名稱
也就是增加
<Context path="" docBase="reportSystem" debug="0" reloadable="true"/>
Ps:
如果設定了 docBase之後,不用加專案名就可以訪問到專案 但這是 訪問不到tomcat的管理介面manager了 這是需要再增加
<Context path="/manager" docBase="manager" debug="0" privileged="true"/>
2.不需要資料埠號就可以訪問專案的配置方法如下:
找到8080埠,然後修改為80埠,最後再重啟Tomcat
- <Connector port="80" protocol="HT
- connectionTimeout="200
- redirectPort="8443" />
myeclipse設定
myeclipse對著專案右鍵選擇properties,web,將Web Context-root設定為/ROOT即可。
eclipse設定
eclipse比myeclipse稍微麻煩一些 需要設定兩個地方
對著專案右鍵選擇properties,Web Project Settings 把Context root 設定為 /。
然後在servers中點選Modules---> Add Web Module ---> 增加 .到我們的專案的對映即可。