问题描述
限时送ChatGPT账号..我正在尝试将 Tomcat 6 网络服务器的默认应用程序更改为与ROOT"(在 webapps 文件夹内)不同的应用程序.这样做的最佳方法是什么?
I'm trying to change the default application of a Tomcat 6 webserver to a different application than "ROOT" (inside webapps folder). What is the best way to do this?
推荐答案
共有三种方法:
首先从 bin
目录 (sh shutdown.sh
) 关闭 Tomcat.然后删除 Tomcat webapps
文件夹 (rm -fr *
) 的所有内容.然后将你的WAR文件重命名为ROOT.war
,最后从bin
目录(sh startup.sh
)启动你的Tomcat.
First shutdown your Tomcat from the its bin
directory (sh shutdown.sh
). Then delete all the content of your Tomcat webapps
folder (rm -fr *
). Then rename your WAR file to ROOT.war
, and finally start your Tomcat from the bin
directory (sh startup.sh
).
将您的 war 文件以原始名称留在 $CATALINA_BASE/webapps
中.关掉server.xml
文件中 Host 元素中的 autoDeploy 和 deployOnStartup.在 server.xml
中明确定义所有应用上下文,同时指定 path和 docBase 属性.您必须这样做,因为您已禁用所有 Tomcat自动部署机制,Tomcat 将不再部署您的应用程序除非它在 server.xml
中找到它们的上下文.
Leave your war file in $CATALINA_BASE/webapps
under its original name. Turn off
autoDeploy and deployOnStartup in your Host element in the server.xml
file.
Explicitly define all application Contexts in server.xml
, specifying both the path
and docBase attributes. You must do this because you have disabled all the Tomcat
auto-deploy mechanisms, and Tomcat will not deploy your applications anymore
unless it finds their Context in the server.xml
.
第二种方法:为了对任何应用程序,您将不得不停止并重新启动Tomcat.
second method: in order to make any change to any application, you will have to stop and restart Tomcat.
将您的 WAR 文件放在 $CATALINA_BASE/webapps
之外(它必须在以防止双重部署).将名为 ROOT.xml
的上下文文件放在 $CATALINA_BASE/conf/
中.此上下文文件中的单个元素必须具有docBase 属性指向您的 WAR 文件的位置.路径元素不应设置 - 它派生自 .xml
文件的名称,在此案例ROOT.xml
.有关详细信息,请参阅上下文容器文档.
Place your WAR file outside of $CATALINA_BASE/webapps
(it must be outside
to prevent double deployment). Place a context file named ROOT.xml
in $CATALINA_BASE/conf/
. The single element in this context file MUST have a
docBase attribute pointing to the location of your WAR file. The path element
should not be set - it is derived from the name of the .xml
file, in this
case ROOT.xml
. See the documentation for the Context container for details.
参考
这篇关于如何更改ROOT应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论