How to change the Tomcat webserver default port

Sometimes there will be a requirement to change the default port number of Tomcat web server over which it runs.

So how to change? Very simple!!

Locate the server.xml file in the tomcat installation directory. It will be available at {Tomcat Installation home directory}\conf folder.

For example,

Here is my tomcat installation directory is E:\J2EE\apache-tomcat-6.0.18. server.xml file can be located at E:\J2EE\apache-tomcat-6.0.18\conf\server.xml

Now, open the server.xml and search for the similar lines,

<Connector port="8081” protocol=”HTTP/1.1″
redirectPort=”8443″ />

Here the above lines states, Tomcat server runs on 8081 port.

So if from browser, if we hit as http://localhost:8081/, we can see the Tomcat server’s default page.

For example, the below instruction tells Tomcat server to run on port 8282,

<Connector port="8282” protocol=”HTTP/1.1″
redirectPort=”8443″ />

Happy ending!! đŸ™‚


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: