转载请以链接形式标明出处: 本文出自:103style的博客
需先配置Java开发环境
Tomcat
Tomcat
首先下载Tomcat,下载地址,点击下载zip
包。
然后解压到某一目录(e.g. D:\apache-tomcat-9.0.14\)
.
win
键,输入 env
,点击 编辑系统环境变量,点击 环境变量
CATALINA_HOME
,变量值 :为tomcat
的目录(e.g. D:\apache-tomcat-9.0.14\)
.Tomcat
目录下的bin
目录添加到path
里(e.g. D:\apache-tomcat-9.0.14\bin)
Tomcat
目录下的lib
目录添加到path
里(e.g. D:\apache-tomcat-9.0.14\lib)
win + R
输入cmd
,进入到cmd 命令行
界面, 切换到tomcat
的bin
目录.e.g.
:
D:
cd apache-tomcat-9.0.14
cd bin
service.bat install
win
键,输入 服务,点击 服务 进入服务界面,在右侧找到 Apache Tomcat 9.0 Tomcat9
服务,右键 选择 属性, 将 启动类型 设置为 自动,点击 启动,然后确定。
http://localhost:8080/
,检查是否可以访问。
假如要访问的文件在 D:\apache-tomcat-9.0.14\webapps
这个文件夹中。
打开 tomcat/conf/server.xml
配置文件,在<host></host>
之间加入下面代码:
<!-- path 表示访问路径 浏览器的访问路径为 http://localhost:8080/webapps/ -->
<!-- docBase 表示访问路径对应的本地磁盘路径 -->
<!-- Debug 则是设定debug level, 0表示提供最少的信息,9表示提供最多的信息 -->
<Context path="/webapps" docBase="D:\apache-tomcat-9.0.14\webapps" debug="0" reloadable="true" />
打开浏览器,输入配置的访问路径,(e.g. http://localhost:8080/webapps/)
,检查是否能访问。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有