Sunday, February 8, 2009

How to change the port that’s used by Tomcat

Today I installed Tomcat 6 and after installation when i tried to open its default page through Firefox 3, it gave me an error ‘Bad Request (Invalid Hostname)’ . After some searching and hit and try, I came to know that the default post used by tomcat which is 8080 was already in use by some other service on my computer thus I changed the post and it started working.

By default, Tomcat uses port 8080. However, if you have a port conflict with another application, you may need to change that port. Here you modify the server.xml file that’s stored in Tomcat’s conf directory. In particular, you replace all instances of 8080 with another four-digit number that’s greater than 1024. After you save the server.xml file and stop and restart the server, the new port should take effect. If, for example, you change from port 8080 to 1979 as shown in this figure, you can access the directory listing for Tomcat’s examples by entering this URL: http://localhost:1979/examples

Because port 80 is the default port for most browsers, another alternative is to change the port from 8080 to 80. Then, you don’t have to enter the port number in your URLs as in this example: http://localhost/examples


-urShadow

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...