How to change the port of Tomcat from 8080 to 80?

后端 未结 13 770
野的像风
野的像风 2020-11-22 17:22

I want to execute my web app as http://localhost.

13条回答
  •  春和景丽
    2020-11-22 17:46

    Ubuntu 14.04 LTS, in Amazon EC2. The following steps resolved this issue for me:

    1. Edit server.xml and change port="8080" to "80"

    sudo vi /var/lib/tomcat7/conf/server.xml
    
    
    

    2. Edit tomcat7 file (if the file is not created then you need to create it)

    sudo vi /etc/default/tomcat7
    

    uncomment and change #AUTHBIND=no to yes

    3. Install authbind

    sudo apt-get install authbind
    

    4. Run the following commands to provide tomcat7 read+execute on port 80.

    sudo touch /etc/authbind/byport/80
    sudo chmod 500 /etc/authbind/byport/80
    sudo chown tomcat7 /etc/authbind/byport/80
    

    5. Restart tomcat:

    sudo /etc/init.d/tomcat7 restart
    

提交回复
热议问题