首先電腦上(無論Windows還是linux系統(tǒng))應(yīng)該裝好java和Tomcat,并設(shè)置好它們的環(huán)境變量。
設(shè)置完成后,啟動Tomcat ,打開瀏覽器輸入網(wǎng)址:http://ip:port,如果出現(xiàn)相應(yīng)的頁面,說明Tomcat安裝成功,可以繼續(xù)下面的配置。
在\conf\server.xml中</Host>下</Engine>上添加如下內(nèi)容
<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")
在網(wǎng)頁輸入ip:port/index.html即可訪問,這里改為對應(yīng)的ip,如果起始頁不是index.html也要進行相應(yīng)的設(shè)置。
演示如下:
1、在tomcat的webapps目錄下新建test文件夾,放入寫好的test.html文件
2、在tomcat的conf\server.xml中設(shè)置如下
![](http://img.jbzj.com/file_images/article/201806/2018625152941637.png?201852515302)
然后啟動tomcat后在瀏覽器輸入ip:port/test.html即可訪問了
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。