Home > Web Front-end > JS Tutorial > How to modify the default port number of tomcat server

How to modify the default port number of tomcat server

下次还敢
Release: 2024-04-21 06:54:38
Original
781 people have browsed it

The default port number of Tomcat server is 8080, which can be modified to other port numbers. It can be modified through server startup parameters or configuration files: Server startup parameters: Specify the port number when starting from the command line, such as: catalina.sh start --server.port=8081 Configuration file: Edit /conf/server.xml, modify and save the changes and restart the server.

How to modify the default port number of tomcat server

How to modify the default port number of the Tomcat server?

The default port number of the Tomcat server is 8080, but you can modify this port number when the server starts or through the configuration file.

Modify the server startup parameters:

  • Enter the following command on the command line to start the Tomcat server and specify the required port number:
<code>catalina.sh start --server.port=8081</code>
Copy after login
  • Alternatively, on Windows systems, you can use the following command:
<code>catalina.bat start /Dserver.port=8081</code>
Copy after login

Modify through the configuration file:

  • Open the /conf/server.xml file in the Tomcat installation directory.
  • Find the following line:
<code class="xml"><Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /></code>
Copy after login
  • Change the value of the port attribute to your desired port number. For example, to change the port number to 8081, modify it as follows:
<code class="xml"><Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /></code>
Copy after login
  • Save the changes and restart the Tomcat server.

Additional Notes:

  • After modifying the port number, you may need to update your firewall rules to allow traffic through the new port.
  • Make sure you have access to the new port.
  • If you encounter problems after modifying the port number, please try to restore the default port number 8080.

The above is the detailed content of How to modify the default port number of tomcat server. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template