Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Web Servers»Tomcat»How to Change Tomcat Port

    How to Change Tomcat Port

    By RahulSeptember 8, 20222 Mins Read

    If you are using a standalone instance of Tomcat in your production environment and are facing connectivity issues related to the port, you may need to change the default port of Tomcat. The default port of Tomcat is the standard port on which it listens for incoming requests. These ports are non-standard and are commonly locked by an administrator.

    Advertisement

    However, if you’ve installed Tomcat as a standalone server and want to change its listening port to a non-standard one, then this article is for you. In this post, we will look at some quick tips on how you can change the default port of Tomcat in a few easy steps. Read ahead to know more!

    Changing the Tomcat Port

    The first step is to identify the location of the Tomcat installation directory. If you have installed Tomcat from default repositories, it should be installed under the /etc/tomcat{VERSION} directory. For the manual installation, you need to find the correct location.

    Then edit server.xml file located under the Tomcat installation directory.

    sudo nano /etc/tomcat9/server.xml 
    

    Find the below content in the configuration file

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

    Replace port 8080 with your required port. For example, we are changing the default tomcat port to 8081.

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

    After making the above changes restart the tomcat service. You will see that now tomcat is started on port 8081 or the port you configured. Access tomcat on the new port in a web browser.

    Change Tomcat default Port

    Conclusion

    Changing the Tomcat port is helpful and required in many cases, the port is already occupied by another service or you may also run multiple Tomcat versions on a single server. This blog post helps you to change the Tomcat port on your system.

    port tomcat
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Open Port in Linux

    How to Show Open Ports in Linux

    How to Check Open (Listening) Ports in Linux

    How to Open Port for a Specific Network in FirewallD

    View 1 Comment

    1 Comment

    1. Ajay on July 17, 2020 9:07 am

      I have configured tomcat connector on one server and create different virtual host domain but I am facing some issue like I have created vms.dev.com:7070 domain and other is vms.test.com:9090 in tomcat server both domain is accessible in browser but when I open vms.dev.com:9090 it will also open and its directory location is test server and when I open vms.test.com:7070 it will also open and its directory location in dev server. it is possible to restrict port access on other domain in same server like if I want to open vms.dev.com:9090 then it should be give some error. Please help me to solve this issue.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.