首先電腦上(無論windows還是linux系統)應該裝好java和tomcat,并設置好它們的環境變量。
設置完成后,啟動tomcat ,打開瀏覽器輸入網址:http://ip:port,如果出現相應的頁面,說明tomcat安裝成功,可以繼續下面的配置。
在\conf\server.xml中</host>下</engine>上添加如下內容
1
2
3
4
5
6
7
|
< host name = "192.168.213.15" debug = "0" appbase = "webapps" unpackwars = "true" autodeploy = "true" xmlvalidation = "false" xmlnamespaceaware = "false" > < context path = "" docbase = "tot" debug = "0" reloadable = "true" crosscontext = "true" /> < logger classname = "org.apache.catalina.logger.filelogger" directory = "logs" prefix = "tot_log." suffix = ".txt" timestamp = "true" /> </ host > |
其中host name="ip地址“ docbase="放在webapps下html文件夾名"
配置好后,把有html的文件夾放在tomcat的webapps目錄下(appbase="webapps")
在網頁輸入ip:port/index.html即可訪問,這里改為對應的ip,如果起始頁不是index.html也要進行相應的設置。
演示如下:
1、在tomcat的webapps目錄下新建test文件夾,放入寫好的test.html文件
2、在tomcat的conf\server.xml中設置如下
然后啟動tomcat后在瀏覽器輸入ip:port/test.html即可訪問了
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。
原文鏈接:https://blog.csdn.net/russ44/article/details/52493531