首页 Tomcat教程tomcat实战案例:手动的应用部署

tomcat应用部署

tomcat实战案例:自动的应用部署

运维派隶属马哥教育旗下专业运维社区,是国内成立最早的IT运维技术社区,欢迎关注公众号:yunweipai
领取学习更多免费Linux云计算、Python、Docker、K8s教程关注公众号:马哥linux运维

实战案例:手动的应用部署

1、一个主页目录下的部署应用文件 test.jsp

[root@centos8 tomcat]#vim webapps/ROOT/test.jsp
[root@centos8 tomcat]#cat webapps/ROOT/test.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>jsp例子</title>
</head>
<body>
后面的内容是服务器端动态生成字符串,最后拼接在一起
<%
out.println("hello jsp");
%>
</body>
</html>

[root@centos8 tomcat]#curl http://127.0.0.1:8080/test.jsp

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>jsp例子</title>
</head>
<body>
后面的内容是服务器端动态生成字符串,最后拼接在一起
hello jsp

</body>
</html>

[root@centos8 tomcat]#tree work/Catalina/localhost/ROOT/
work/Catalina/localhost/ROOT/
└── org
    └── apache
        └── jsp
            ├── test_jsp.class
            └── test_jsp.java

3 directories, 2 files
[root@centos8 tomcat]#

2、手动部署一个子目录的应用

[root@centos8 tomcat]#pwd
/usr/local/tomcat
[root@centos8 tomcat]#mkdir webapps/testapp1/

#利用之前实验的文件生成新应用
[root@centos8 tomcat]#cp -p webapps/ROOT/test.jsp  webapps/testapp1/
[root@centos8 tomcat]#chown -R tomcat.tomcat webapps/testapp1/
[root@centos8 tomcat]#tree webapps/testapp1/
webapps/testapp1/
└── test.jsp

0 directories, 1 file
[root@centos8 tomcat]#curl http://127.0.0.1:8080/testapp1/test.jsp

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>jsp例子</title>
</head>
<body>
后面的内容是服务器端动态生成字符串,最后拼接在一起
hello jsp

</body>
</html>[root@centos8 tomcat]#tree work/Catalina/localhost/testapp1/
work/Catalina/localhost/testapp1/
└── org
    └── apache
        └── jsp
            ├── test_jsp.class
            └── test_jsp.java

3 directories, 2 files
[root@centos8 tomcat]#

#删除应用
[root@centos8 tomcat]#rm -rf webapps/testapp1/
[root@centos8 tomcat]#ls webapps/
docs  examples  host-manager  manager  ROOT
[root@centos8 tomcat]#ls work/Catalina/localhost/
docs  examples  host-manager  manager  ROOT

本文链接:https://www.yunweipai.com/35135.html

tomcat应用部署

tomcat实战案例:自动的应用部署

网友评论comments

发表回复

您的电子邮箱地址不会被公开。

暂无评论

Copyright © 2012-2022 YUNWEIPAI.COM - 运维派 京ICP备16064699号-6
扫二维码
扫二维码
返回顶部