By default, Tomcat is listening on the port number 8080 (for HTTP Connector) and 8009 (for AJP Connector), as shown in the following screenshot of Tomcat’s console when the server is started:
Sometimes, one needs to change these default port numbers because of conflict with other applications or just for convenience, e.g. change HTTP port number from 8080 to 80 in order to type the URL without specifying the number.
It’s very easy to change the port numbers in Tomcat, by doing the following steps:
Sometimes, one needs to change these default port numbers because of conflict with other applications or just for convenience, e.g. change HTTP port number from 8080 to 80 in order to type the URL without specifying the number.
It’s very easy to change the port numbers in Tomcat, by doing the following steps:
- Make sure the server is stopped, or shutdown it if it is running.
- Open the server.xml file which can be found under TOMCAT_INSTALL_DIR\conf directory:
- If we want to change the HTTP port number, search for the following lines:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
- Now change the port 8080 to 80:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
- Save the server.xml file (make sure you have write permission) and restart Tomcat. Now, we can see the HTTP port number gets changed in the console: