jieqiuming / jieqiuming.github.io

记录我的学习、生活过程
MIT License
0 stars 0 forks source link

夜读之tomcat #3

Open jieqiuming opened 7 years ago

jieqiuming commented 7 years ago

tomcat简介

tomcat为何物?能做什么?

实战

生成war包

mvn clean install

如何部署java代码包(war)?

  1. conf目录结构
│  catalina.policy
│  catalina.properties
│  context.xml
│  logging.properties
│  server.xml
│  tomcat-users.xml
│  web.xml
│  
└─Catalina
    └─localhost
  1. context.xml
<!-- The contents of this file will be loaded for each web application -->
<Context path="/" docBase="D:/project/WebUploaderDEMO/src/target/WebUploaderDEMO.war">

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->

</Context>
  1. server.xml
<Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

运行tomcat

原理