开发者

Virtual hosting in Tomcat 7

I'm trying to have virtual hosts in Tomcat 7.0.20

WITHOUT rename everything ROOT AND WITHOUT using Apache http server in front

Steps don开发者_开发问答e so far

put fake domain in windows host file 127.0.0.1 fakedomain.com

Started Tomcat and logged into Host Manager. Add virtual host. Name : fakedomain.com Aliasas : www.fakedomain.com App base: fakedomain Yes to all settings

At this point tomcat creates the app directory and conf directory and setups the manager app for the fake domain.

I copy a WAR file 'Animotest-1.war' to the fakedomain app directory. I can now access my app using http://fakedomain.com/Animotest-1/. Small victory :)

Now I'm trying to set it as my default app

My understanding is that I need to put a ROOT.xml file in the conf/Catalina/fakedomain.com directory with some variation of the following content.

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="C:\Java\apache-tomcat-7.0.20\fakedomain\Animotest-1">
</Context>

The resulting behavior is that tomcat now shows me the ROOT page that comes with with Tomcat not my virtual host app and my app is now 404.

Any clues?


Right answer from chuck at unisys.com from the tomcat mailing list.

Not sure why you want to do things the hard way, but so be it.

You need to place the Animotest-1.war in a location outside of the appBase directory so that Tomcat won't find it via auto-deployment. Put the full path in the docBase attribute (as you have done - just needs to be in a location outside of Tomcat's directory structure). Make sure there is no ROOT directory or ROOT.war file under the appBase, and erase Tomcat's work directory to make sure there's nothing confusing in there left over from previous deployments.

  • Chuck


Deploy application on custom host of Tomcat

Worked for me, no windows host file modification necessary. I think the key for me was having the appbase in the root.xml and in the server.xml. Had to remove it from server.xml and everything was gravy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜