Apache Tomcat伺服器安裝配置和部署執行
阿新 • • 發佈:2018-12-09
Apache Tomcat伺服器安裝配置和部署執行
在Windows 64位系統上安裝配置和部署執行Apache Tomcat伺服器。
1,先下載適應於64為Windows作業系統的Tomcat伺服器。
連線:http://tomcat.apache.org/
我下載的是:
2,解壓:
3,配置Tomcat伺服器的執行環境和Java環境。
我是通過寫bat批處理檔案實現,不需要配置Windows系統的環境變數,只需要簡單的寫一個bat批處理檔案,點選執行後即可啟動Tomcat伺服器,具體的啟動Tomcat伺服器.bat的程式碼如下:
set path=D:\code\apache-tomcat\bin set JAVA_HOME=C:\program\java\jdk set CATALINA_HOME=D:\code\apache-tomcat start D:\code\apache-tomcat\bin\startup.bat
如果配置正確,在瀏覽器輸入 locahost:8080即可開啟Tom貓的歡迎頁面。
現在如果想換掉自己寫的歡迎頁面,比如想在瀏覽器開啟locahost:8080地址後,開啟一個叫做 zhangphil.html檔案,那麼需要修改apache-tomcat\conf\web.xml檔案,找到web.xml裡面的定義welcome-file-list,原始的定義是這樣的:
通過locahost:8080預設開啟的就是welcome-file-list下面定義的檔案,Tomcat伺服器會自動從上往下尋找列表中的檔案,找到就載入。可以把第一個index.html改成zhangphil.html即可實現預設的開啟自己寫的zhangphil.html檔案:
那zhangphil.html應該放在哪裡呢?是在ROOT下面,即apache-tomcat\webapps\ROOT:
修改好web.xml,把zhangphil.html放到ROOT下面,此時再開啟locahost:8080後: