This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
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.
What do you mean by "redirected"? Does the Tomcat run on the IP address pointed to by the DNS entry for your domain name?
Joined: Aug 05, 2008
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?
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.
Joined: Aug 05, 2008
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,
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?