Tomcat部署项目的3种方式
一、第一种
第一种最为简单,将我们打包或编译好的项目直接放置在 tomcat安装路径/webapps 路径下。
访问方式:localhost:8080/项目名称 项目名称:放在webapps下的文件夹的名字
二、第二种
通过配置文件配置:在 tomcat安装路径/conf/server.xml 文件中添加如下配置
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<context docBase="xxx/xxxx/xxx" path="xxx/xxxx/xxx" />
</Host>
--------------------------
docBase:项目的存放路径
path=项目的访问路径(虚拟路径)
三、第三种
通过配置文件配置:在 tomcat安装路径/conf/catalina/localhost/ 下新建 xxx.xml 文件
内容为
<context docBase="xxx/xxxx/xxx" />
-----------------------
docBase:项目的存放路径
虚拟目录(访问路径): xxx.xml的文件名称xxx