Jtti: how to modify the tomcat port number in linux

To modify the port number of Tomcat, you need to edit the Tomcat configuration file server.xml, which is located confin the directory of Tomcat. The following are the specific steps:

  1. Connect to your Linux server using Terminal or SSH.

  2. Enter confthe directory of Tomcat. By default, Tomcat's confdirectory is located in the subdirectory of the Tomcat installation directory conf.

    cd /path/to/tomcat/conf

  3. Open the file with a text editor such as vior .nanoserver.xml

    vi server.xml

  4. In the opened server.xmlfile, find the following line, which is Tomcat's default HTTP connector configuration:

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

    By default, Tomcat uses port 8080 as the port number for the HTTP connector.

  5. Modify portthe value of the attribute to the port number you want, for example, to 8081:

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

  6. Save changes and exit the editor.

  7. Restart the Tomcat service to make the configuration take effect.

    ./startup.sh

Tomcat's HTTP connector will now use the new port number you specified. Please make sure that the new port number is not occupied by other processes or services, otherwise Tomcat will not start normally. After completing the above steps, you can access Tomcat by accessing the new port number through a browser. For example, if you change the port number to 8081, you can http://your_server_ip:8081access Tomcat through .

Guess you like

Origin blog.csdn.net/JttiSEO/article/details/131920610