The steps to modify the Tomcat port number are as follows: Modify the port attribute in the <Connector> element in the server.xml file to the required port number. Save changes and restart Tomcat. Verify that the port number has been modified successfully via the command line or browser.
Tomcat port modification guide
Port number location
Modification The Tomcat port number needs to be modified in the server.xml
file, which is located in the conf
folder under the Tomcat installation directory.
Modification steps
server.xml
file. Use a text editor to open the server.xml
file. <Connector>
element. Look for the <Connector>
element, which specifies the port number that Tomcat is listening on. port
attribute in the <Connector>
element and change it to the required port number. server.xml
file. Example
The following is an example of a <Connector>
element that modifies the port number to 8088:
<code class="xml"><Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /></code>
Restart Tomcat
After modifying the port number, you need to restart Tomcat for the change to take effect.
Stop Tomcat. Stop Tomcat by executing the following command:
<code class="bash">catalina.sh stop</code>
Restart Tomcat. Restart Tomcat by executing the following command:
<code class="bash">catalina.sh start</code>
Verify changes
You can verify whether the port number has been successfully modified by the following method:
Use the command line. Execute the following command in the command line:
<code class="bash">netstat -an | grep 8088</code>
After successfully modifying the port number, the command should display the Tomcat process that is listening on port 8088.
http://localhost:8088
in the browser. If Tomcat has successfully modified the port number, the Tomcat welcome page should be displayed. The above is the detailed content of Where to change the tomcat port. For more information, please follow other related articles on the PHP Chinese website!