将根上下文更改为 tomcat 6 中的其他文件夹 [英] Change the root context to other folder in tomcat 6

查看:25
本文介绍了将根上下文更改为 tomcat 6 中的其他文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改已部署的 Web 应用程序的上下文.目前它是通过 url www.app.mysite.com/dashboard

I want to change the context of my deployed web application. Currently it is accessed by the url www.app.mysite.com/dashboard

但我想把它改成www.app.mysite.com/application/dashboard

我通过帖子更改了根上下文 此处此处.但问题是我在该服务器上运行了其他应用程序,这些应用程序由

I went through post to change the root context here and here. But the thing is that i have other applications running to on that server which are accessed by

www.app.mysite.com/ps
www.app.mysite.com/ls

如果我更改 server.xml 中的上下文路径,它会影响我其他应用程序的上下文吗?我不想更改上述应用程序的上下文,但我想为我的特定应用程序仪表板更改它.

If i change the context path in server.xml will it affect context of my other application ?I dont want the context to change for above mentioned apps, but i want to change it for my particular application dashboard.

有没有办法通过向 web.xml 或其他内容添加任何内容来更改任何特定应用程序的上下文?

Is there any way to change the context of any particular application, by adding any thing to web.xml or other?

推荐答案

这是一种方法(循序渐进):

This is a way to do it (step-by-step):

  1. 将扩展的 WAR 放在webapps 之外的目录.我的 TOMCAT_HOME 是 /home/nikos/apache-tomcat-6.0.37,我将我的应用程序放在文件夹 myapp 下的一个新文件夹中:$TOMCAT_HOME/webapps-手册.IE.文件夹结构为:

  1. Put your expanded WAR in a directory outside of webapps. My TOMCAT_HOME is /home/nikos/apache-tomcat-6.0.37 and I placed my app in the folder myapp under a new folder: $TOMCAT_HOME/webapps-manual. I.e. the folder structure is:

$TOMCAT_HOME
|
+- ...
|
+- webapps (NOT HERE!!!)
|
+- webapps-manual
   |
   +- myapp
      |
      +- index.jsp
      |
      +- WEB-INF
         |
         +- web.xml (optional)

  • 编辑 TOMCAT_ROOT/conf/server.xml.在相应的 元素下添加以下 (可能只有一个):

  • Edit TOMCAT_ROOT/conf/server.xml. Add the following <Context> under the appropriate <Host> element (there is probably only one):

    <Host ...>
        <Context
            path="/application/dashboard"
            docBase="/home/nikos/apache-tomcat-6.0.37/webapps-manual/myapp"
        />
    </Host>
    

  • 完成!打开http://localhost:8080/application/dashboard/index.jsp,查看$TOMCAT_HOME/webapps-manual/myapp/index.jsp生成的内容.>

  • 查看相关文档这里(查看属性路径docBase).

    See relevant documentation here (see attributes path and docBase).

    这篇关于将根上下文更改为 tomcat 6 中的其他文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆