我如何从Grails应用程序的URL中删除应用程序名称? [英] How can I remove the application name from a Grails application’s URL?

查看:94
本文介绍了我如何从Grails应用程序的URL中删除应用程序名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序运行在这样的URL上:


http://myapp.mydomain.com/myapp


我不希望 / myapp 部分。那么我该如何摆脱应用程序名称?我只想要


http://myapp.mydomain.com


为网址。我该如何做到这一点?

解决方案

位详细方法

<第一种方法:

lockquote

首先关闭你的tomcat [从bin目录( sh shutdown)。那么你的
必须删除你的tomcat webapps文件夹的所有内容( rm -fr * ),然后
将你的WAR文件重命名为 ROOT.war 最后从bin目录( sh startup.sh 第二种方法:




blockquote>

将您的war文件放在 CATALINA_BASE / webapps 的原始名称下 - 关闭
autoDeploy和deployOnStartup server.xml文件。
显式定义server.xml中的所有应用程序上下文,指定路径
和docBase。您必须这样做,因为您已禁用了所有的Tomcat
自动部署机制,并且除非在server.xml中找到它们的Context,否则Tomcat不会再部署您的应用程序


注意:
$ b


最后一种方法也意味着,为了对任何
应用程序进行任何更改,您必须停止并重新启动Tomcat。


第三种方法:


将您的war文件放在 CATALINA_BASE / webapps code>(它必须在
之外以防止双重部署)。 - 在

CATALINA_BASE / conf // 中放置一个名为 ROOT.xml 的上下文文件。这个上下文文件中的单个元素必须有一个
的docBase属性指向你的war文件的位置。路径元素
不应该被设置 - 它来源于.xml文件的名称,在这个
的情况 ROOT.xml 中。有关详细信息,请参阅上面的上下文容器。



I have an application running at a URL like this:

http://myapp.mydomain.com/myapp

I don’t want the /myapp part in the URL. So how can I get rid of the application name? I want just

http://myapp.mydomain.com

to be the URL. How can I do this?

解决方案

bit detailed approach

First Method:

first shutdown your tomcat [from the bin directory (sh shutdown.sh)] then you must delete all the content of your tomcat webapps folder (rm -fr *) then rename your WAR file to ROOT.war finally start your tomcat [from the bin directory (sh startup.sh)]

Second Method:

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 path and docBase. 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.

Note:

that this last method also implies that in order to make any change to any application, you will have to stop and restart Tomcat.

Third Method:

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 Context Container above for details.

这篇关于我如何从Grails应用程序的URL中删除应用程序名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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