Environment:
•Windows Server (64) 2003
•Apache Tomcat 6.0.18
•IIS 6
Still recently what were we doing to access the web application is,
we are binding domain name "xyz.com" to the IIS which is running on port 80, and then this IIS redirects the page to local instance of tomcat, which is running on port 8080, as
http://localhost:8080/WebApp
So when someone hits www.xyz.com the server redirects to the URL as
http://xyz.com:8080/WebApp.
Now we need some changes into it
1.Remove port 8080 from URL (pretty easy)
Open CATLINA_HOME/conf/server.xml and search for number 8080 and replace by 80, save it and you're done. But wait, if you restarted the tomcat, it will throw exception, like ‘JVM_bind: port 80 is already in use’ and this is because of the IIS server running on that default port 80, so stop it...
2.Get the direct access to Tomcat, instead of IIS-Redirecting-Tomcat(Tomcat Virtual Host settings)
Virtual hosting is easy in a Tomcat, (though many people suggest me, to use Apache web server, HTTPD, which acts like IIS, and then redirect the request to tomcat, which I didn't understand it, yet :)),
We need some edits in following xml
Caution: Before modifying this files make sure you had backup this files, so that if anything goes wrong you need not worry about the original files.
a. Create a virtual host, which maps xyz.com to the correct application deployed. Note that the
view plaincopy to clipboardprint?
01.
03.
Here,
b. Create
01.
03.
04.
After this just rename your web application's war file as 'ROOT.war', so that's it context path changes from "YOUR_WEB_APP_NAME" to "/" and application can be accessed as 'www.xyz.com', simply.
So finally, this files/directory you got in 'xyzwebapps'
CATALINA_HOME/xyzwebapps/
./ROOT.war
./ROOT
Restart the server, hit http://www.xyz.com and you're good to go :)
PS: Here is the beautiful link to implement SSL on Tomcat, you just need a private key from your host provider. Its easy and straightforward.
http://blog.datajelly.com/company/blog/34-adding-ssl-to-tomcat.html