Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to serve my website www.mywebsite.com using tomcat.

I am not using apache and using tomcat as my webserver only. I have defaulted port to 80 and currently I have mywebsite.war lying in webapps folder. When I start tomcat, mywebsite unzips and gets deployed to a folder named mywebsite in webapps only.

The problem I am facing is that when I try to access my site as www.mywebsite.com , it opens tomcat welcome page not my website [which is understandable s some issue in my configuration].

To access my website, I have to type the sub-folder name as well. That means, I use www.mywebsite.com/mywebsite/welcome.html to access my web site.

Could some one please guide me about how can I serve my website from www.mywebsite.com only ?

What extra configuration will I have to do here?

share|improve this question
    
are you using apache infront of Tomcat? –  Abhishek Anand Amralkar May 15 '13 at 5:43
    
Nope, I am not using apache like I mentioned earlier. –  Sfdc Workhorse May 15 '13 at 6:24
    
This question on stackoverflow should be helpful: stackoverflow.com/questions/1363605/tomcat-base-url-redirection There are a couple of ways detailed there to do what you want. –  davey May 15 '13 at 7:30
add comment

2 Answers

When tomcat receive a request, it tries to understand what webapps is responsible for it. The way it assign request to webapp is checking the context, i.e., the first part of the url path. Since your webapps have a context of mywebsite, then it only gets requests that start with path /mywebsite/. When tomcat does not find a suitable web apps, it defaults to the ROOT context.

So, in order to catch all such requests, you should name your webapp as ROOT (or probably just change its context to ROOT), or install a different webapps on the ROOT context that redirect to your current URL.

share|improve this answer
add comment

What you are trying to do, is to load your application as "ROOT context". To do that you have two easy choices :

  1. Put your files directly in place of Tomcat defaults files (/webapps/ROOT/here), replacing webapps/ROOT/WEB-INF/web.xml, etc.
  2. Renaming your war to ROOT.war and putting it inside /webapps/ROOT.war

I also recommand removing all default Tomcat files in this directory.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.