IDEA部署Tomcat for mac

部署项目有三种方式
例如,我们创建一个项目 Hello,项目内只有一个文件 hello.html
方式一:直接将项目放到webapps目录下即可。(不推荐)
① 浏览器访问:http://localhost:8080/hello/hello.html
② 简化部署:将项目打包成后缀为.war的包,再将war包放置到webapps目录下,war包会自动解压缩。
方式二:配置conf/server.xml 文件(不推荐)

  1. 打开server.xml文件
  2. 找到<host标签>,在标签体内配置:<Context docBase="项目存放的路径" path="/虚拟目录" />
    • docBase:项目存放的路径
    • path:表示虚拟目录
    • Context必须大写,且是自闭和标签

例如:桌面的hello文件夹内有hello.html文件:<Context docBase="/Users/Kingdev/Desktop/hello" path="/hehe" />
浏览器访问:http://localhost:8080/hehe/hello.html
方式三:在conf/Catalina/localhost创建任意名称的xml文件:
在文件中编写:
<Context docBase="/Users/Kingdev/Desktop/hello" />


IDEA部署Tomcat


第一步:
run ——> Edit Configurations
在这里插入图片描述
第二步:
在这里插入图片描述
第三步:
在这里插入图片描述
第四步:
查看配置是否成功
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_41463971/article/details/88413623