Modifying the Tomcat Port Number

  • Last update: October 29, 2025
  • Overview

    Description

    • The project is deployed in a Tomcat environment with a default port of 8068. You want to switch it to another port.

    • When starting multiple Tomcat-deployed projects on one server, the startup fails because multiple projects share the same port, causing port conflicts. You need to modify the port.

    Implementation Method

    Modify the port number in the server.xml file in Tomcat installation directory\conf\server.xml.

    Procedure

    Opening the Configuration File

    Open the file in Tomcat installation directory\conf\server.xml using a text editor.

    Reconfiguring the Port Number

    1. To change the port number to 8067, for example, locate the Connector port setting in the server.xml file, modify it as follows, and save the file.

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

    2. Restart the Tomcat server.

    iconNote:
    Only the root user has the permission to occupy ports below 1024 in Linux. Therefore, you are advised to change the Tomcat port number to above 1024 in Linux, such as 8081 and 8082.

    Configuring Port Numbers for Multiple Concurrent Tomcat Instances

    In scenarios where multiple Tomcat instances need to run simultaneously, port configuration is essential to prevent conflicts.

    For example, to modify the port numbers for a second Tomcat instance, locate the server.xml file in the conf directory in the installation folder of the second Tomcat container, and modify the HTTP port, the SHUTDOWN port, and the AJP port.

    1. Modify port numbers.

    • The HTTP port handles HTTP requests, such as browser access. The default port number is 8068. Modify it to 8081 as follows.

    <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
    • The SHUTDOWN port accepts the server shutdown command. The default port number is 8005. Modify it to 8006 as follows.

    <Server port="8006" shutdown="SHUTDOWN">
    • The AJP port listens for requests forwarded from other servers using the AJP protocol. The default port number is 8009. Modify it to 8010 as follows.

    <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />

    2. Restart the Tomcat server.

    iconNote:
    To enable a third Tomcat instance, ensure the HTTP, SHUTDOWN, and AJP ports configured in the corresponding server.xml file differ from those used by the first two instances. The same principle applies for additional instances.

    附件列表


    主题: Deployment and Upgrade
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy