tomcat默认端口是多少?
tomcat默认端口是8080端口。
当我们不想使用8080端口,需要修改为其他端口时,我们可以:
推荐:《Java学习》
1, 打开tomcat安装目录下的conf目录,找到server.xml文件。
找到以下代码
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
2,修改端口号
上面的8080就是tomcat的对外访问端口,
我们将他修改为其他端口,但是要避免与系统的端口号冲突,选用一个没有使用过的端口号,然后保存退出
如图将端口号修改为8099
<Connector port="8099" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
3, 重启tomcat生效
[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]#