apache tomcat部署web应用的三种实现方式,apachetomcat


工具:apache-tomcat-8.0.33 + windows 10 + JDK 1.7

第一种方式:

(1)将自己的web应用放到解压后的tomcat的webapps目录下。这是最简单,最传统,也是最常用的一种方式!

 (2)双击tomcat的bin目录下的startup.bat 文件,若启动窗口中没有错误信息输出,即tomcat启动成功!

 (3)打开浏览器窗口输入localhost:8080即可访问到tomcat管理界面,输入localhost:8080/THEME/ 即可访问到自己的web应用界面。

 

第二种方式:(注意:测试第二种方式需要提前把第一种方式中的webapps下的THEME目录移除)

(1)找到并编辑修改apache-tomcat-8.0.33\conf/server.xml文件。

    
(2)保存退出后,启动tomcat服务,启动方式同一。在浏览器中输入访问地址即可访问成功!


第三种方式:(注意:测试第三种方式需要提前把第二种方式中的server.xml中的配置移除)

(1)进入目录apache-tomcat-8.0.33\conf\Catalina\localhost,在该目录创建一个THEME.xml文件。

注意:新下载的tomcat在conf目录下没有Catalina目录,此时需要先去启动一下tomcat服务,目录就会出现。

    文件内容为:

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<Context path="/THEME" docBase="E:\test-web\THEME" />
(2)保存后,启动tomcat服务。浏览器中输入访问地址即可访问成功!

相关内容

    暂无相关文章