This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Tomcat 6 and DNS Lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 6 and DNS Lookup" Watch "Tomcat 6 and DNS Lookup" New topic

Tomcat 6 and DNS Lookup

Anirban Chowdhury
Ranch Hand

Joined: Aug 05, 2008
Posts: 36
Hi Ranchers,
I am running a web application on Tomcat 6.0.32 on CentOS 5 system. I have already got a domain (say registered . Now, how do I go about mapping the domain to my webapplication. Currently, my webapplication will open up like

I want it to be redirected from
I have tried the virtual hosting options like below in server.xml, but it did not work out.

Could somebody please light the way a bit!! I googled a lot, but couldn't get a satisfactory answer.

Thanks a lot in advance.

Thanks & Regards,

To living life on the edge! I blog my experiences @
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
What do you mean by "redirected"? Does the Tomcat run on the IP address pointed to by the DNS entry for your domain name?
Anirban Chowdhury
Ranch Hand

Joined: Aug 05, 2008
Posts: 36
Hi Ulf,
Thank you for the response.
1. As of now, only a DNS name has been registered ( It does not have an IP address mapped to it.
2. I have a Tomcat running @ and if I hit the URL , it shows my website.
3. How or rather where do I map the IP to the DNS? Can I do it on my own, or do I have to go back to the DNS registrars for doing it?

Thanks & Warm Regards,
Anirban Chowdhury

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

<eidt>deleted my post. since it wont help OP</edit>
Anirban Chowdhury
Ranch Hand

Joined: Aug 05, 2008
Posts: 36
Seetharaman Venkatasamy wrote:[not sure]change the port number to 80 from 8080 and then try!

It's not going to work, as I already have an Apache Web Server running on 80, and anyway the IP mapping is not done. It has to be done somewhere , I am sure

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17273

DNS resolves ONLY IP addresses. Not port numbers.

Port number selection is done by the client (browser). The standard/default ports that a browser will pick when not given a URL that includes an explicit port number are 80 (http) and 443 (https).

To get a simple URL to be routed to port 8080 you need server-side help to translate from the port-70/443 or port 8080/8443 (or whatever). The most common approach is to front-end Tomcat with a general-purpose webserver such as Apache and let Apache proxy things. You can also use an http proxy server such as Squid.

If the Tomcat webapp has its own distinct IP address, various routing tricks can be used - either by programming the port redirection in the router that feeds Tomcat or by using an internal system such as Linux' IPTABLES.

An IDE is no substitute for an Intelligent Developer.
Anirban Chowdhury
Ranch Hand

Joined: Aug 05, 2008
Posts: 36
Hi Tim,
Thanks for the comments. Ok, if I have understood correctly, I would have to configure the port correctly, via Tomcat/Apache so that if I hit it will route to only as the site is http. But where / how do I map = ?

Thanks & Warm Regards,

PS: I contacted the hosting service providers , and they told me that the IP can be mapped easily via Plesk , which I do not want to be installed as then I have to re-install mySQL and other dependant s.w. Any ideas folks?
subject: Tomcat 6 and DNS Lookup
It's not a secret anymore!