Home > Article > Web Front-end > How to configure port number in tomcat
To configure the Tomcat port number, open the server.xml file, find the Connector element, modify the port attribute to the required port number, save the file and restart Tomcat. Verify that the port number has changed by using the netstat command.
How to configure the Tomcat port number
Tomcat uses port 8080 by default, but sometimes you may need to change it to other ports. The following is how to configure the Tomcat port number:
1. Open the Tomcat server configuration file
2. Find the Connector element
in server.xml file, find the following code block:
<code class="xml"><Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /></code>
3. Modify the port number
Modify the port attribute to set the port number you want to use. For example, to use port 9090, change to the following code:
<code class="xml"><Connector port="9090" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /></code>
4. Save and restart Tomcat
Save the server.xml file and restart the Tomcat server to Make the changes effective.
5. Verify the port number
After rebooting, you can check if the port number has changed using the following command:
The above is the detailed content of How to configure port number in tomcat. For more information, please follow other related articles on the PHP Chinese website!