Tomcat使用经验

1.启动和关闭

bin目录下

startup.bat    ##window下启动服务
shutdown.bat    ##window下关闭服务

startup.sh    ##Linux下启动服务
shutdown.sh    ##Linux下关闭服务

 

2.修改默认访问端口

conf目录下server.xml里面;默认8080端口;默认访问页面网址127.0.0.1:8080或者localhost:8080

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

改为8088端口;更改后访问页面网址127.0.0.1:8088或者localhost:8088

<Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

 

3.修改默认访问页面

页面默认路径,webapps目录下ROOT  中(例如我的:E:\Apache\apache-tomcat-8.5.54\webapps\ROOT)

conf目录下web.xml里面最底部;

<welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

添加myweb.html;修改为

<welcome-file-list>
  <welcome-file>myweb.html</welcome-file>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

webapps目录下ROOT中增加myweb.html;

启动服务,浏览器访问

http://localhost:8088

启动访问myweb.html就变成默认页面了。

 

4.修改默认访问路径

页面默认访问路径,webapps目录下ROOT  中(例如我的:E:\Apache\apache-tomcat-8.5.54\webapps\ROOT)

conf目录下server.xml里面;找到<Host

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

后面添加

<Context path="/" docBase="e:\\Apache\\web" debug="0" reloadable="false" />

把myweb.html网页放到E:\Apache\web\目录下

webapps目录下ROOT下文件和文件夹全部删除掉

启动服务,浏览器访问

http://localhost:8088

 

posted @ 2020-04-18 22:28  杵臼  阅读(172)  评论(0编辑  收藏  举报