Tomcat默认在端口8080上运行,但是很有可能与其他程序发生端口冲突。 有时我们只需要更改Tomcat端口号。
更改Tomcat端口的步骤
1)在{Tomcat安装文件夹} \ conf \中找到server.xml 。
2)找到以下类似的陈述
<!-- Define a non-SSL HTTP/1.1 Connector on port 8180 -->
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
要么
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
3)关于Tomcat的server.xml文件引用它在端口8080上运行。将连接器端口=“ 8080”端口更改为任何其他端口号。
例如
<Connector port="8181" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
以上声明指示Tomcat服务器在端口8181上运行。
4)编辑并保存server.xml文件。 重新启动Tomcat。 完成了
翻译自: https://mkyong.com/tomcat/how-to-change-tomcat-default-port/