aspose file tools*
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
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 6 and DNS Lookup" Watch "Tomcat 6 and DNS Lookup" New topic
Author

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 abcd.sg) registered . Now, how do I go about mapping the domain to my webapplication. Currently, my webapplication will open up like
http://xx.xxx.xxx.xxx:8080/webappname

I want it to be redirected from abcd.sg..
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.
Anirban


Thanks & Regards,
Anirban



To living life on the edge! I blog my experiences @ http://anirbanchowdhury.wordpress.com.
Ulf Dittmer
Marshal

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


Ping & DNS - my free Android networking tools app
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 ( abcd.sg). It does not have an IP address mapped to it.
2. I have a Tomcat running @ xx.xxx.xxx.xxx:8080 and if I hit the URL http://xx.xxx.xxx.xxx:8080/webappname , 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: 16014
    
  20

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
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 abcd.sg it will route to only xx.xxx.xxx.xxx:80 as the site is http. But where / how do I map abcd.sg = xx.xxx.xxx.xxx ?

Thanks & Warm Regards,
Anirban.

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat 6 and DNS Lookup