Home >Java >Javagetting Started >What is the default port of tomcat

What is the default port of tomcat

藏色散人
藏色散人Original
2020-02-18 11:07:0725540browse

What is the default port of tomcat

What is the default port of tomcat?

The default port of tomcat is port 8080.

When we don’t want to use port 8080 and need to change it to another port, we can:

Recommended: "Java Learning"

1, open In the conf directory under the tomcat installation directory, find the server.xml file.

Find the following code

  <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

2, modify the port number

The 8080 above is the external access port of tomcat,

We will modify it to other ports , but to avoid conflict with the system port number, choose an unused port number, then save and exit

Change the port number to 8099

  <Connector port="8099" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

3, restart tomcat to take effect

[root@distzabbix tomcat]# netstat -luntp|grep 80
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      26201/java
tcp6       0      0 :::8009                 :::*                    LISTEN      26201/java
tcp6       0      0 :::8080                 :::*                    LISTEN      26201/java
tcp6       0      0 :::80                   :::*                    LISTEN      850/httpd
[root@distzabbix tomcat]# ./bin/shutdown.sh
Using CATALINA_BASE:   /usr/share/tomcat
Using CATALINA_HOME:   /usr/share/tomcat
Using CATALINA_TMPDIR: /usr/share/tomcat/temp
Using JRE_HOME:        /usr/share/jdk
Using CLASSPATH:       /usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar
[root@distzabbix tomcat]# ./bin/startup.sh
Using CATALINA_BASE:   /usr/share/tomcat
Using CATALINA_HOME:   /usr/share/tomcat
Using CATALINA_TMPDIR: /usr/share/tomcat/temp
Using JRE_HOME:        /usr/share/jdk
Using CLASSPATH:       /usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@distzabbix tomcat]# netstat -luntp|grep 80
tcp6       0      0 :::8099                 :::*                    LISTEN      5163/java
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      5163/java
tcp6       0      0 :::8009                 :::*                    LISTEN      5163/java
tcp6       0      0 :::80                   :::*                    LISTEN      850/httpd
[root@distzabbix tomcat]#

For more programming-related content, please pay attention to the Programming Introduction column on the php Chinese website!

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

Statement:
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