How to change Tomcat default port

  • 04 April 2018
  • ADM

 

How to change Tomcat default port - images/logos/java.jpg

 

By default, Apache Tomcat runs on port number 8080. If you need to change the default port follow the next steps.

Step1 - Locate the settings.xml

The settings.xml configuration file is located in {TOMCAT_INSTALLATION_FOLDER\conf} folder.

Step2 - Locate <Connector> section

Depending on the active protocol you can have different variants of the <Connector> element.

e.g.

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

or

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />

or

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

Step3 - change the <port> attribute

Change the port, save the file and restart the Tomcat.

 

References