Tomcat 如何为两个不同的上下文进行单一部署?

Tomcat 如何为两个不同的上下文进行单一部署?,tomcat,Tomcat,在我们的环境中,我有多个上下文(ROOT、myapp、backup) URLlocalhost:8080/myapp&localhost:8080需要访问相同的应用程序myapp 为此,我正在tomcat/webapps/ROOT目录和tomcat/webapps/myapp目录中部署myapp应用程序 有没有办法避免这种多重部署?我正在使用apachetomcat 7您可以在根路径中添加index.html,将浏览器重定向到您的应用程序url: <!DOCTYPE HTML> &l

在我们的环境中,我有多个上下文
(ROOT、myapp、backup)

URL
localhost:8080/myapp
&
localhost:8080
需要访问相同的应用程序
myapp

为此,我正在
tomcat/webapps/ROOT
目录和
tomcat/webapps/myapp
目录中部署
myapp
应用程序


有没有办法避免这种多重部署?我正在使用apache
tomcat 7

您可以在根路径中添加index.html,将浏览器重定向到您的应用程序url:

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1;url=./myapp/">
        <script type="text/javascript">
            window.location.href = "./myapp/"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
        If you are not redirected automatically, follow the <a href='./myapp/'>link to example</a>
    </body>
</html>

window.location.href=“./myapp/”
页面重定向
如果没有自动重定向,请按照

首先,我们考虑过这种方法,在我的环境中,重定向是不可能的,在tomcat配置级别本身还有什么需要做的吗?