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

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

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

相关标签:
13条回答
  • 2020-11-22 17:38

    1) Go to conf folder in tomcat installation directory

     e.g. C:\Tomcat 6.0\conf\
    

    2) Edit following tag in server.xml file

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

    3) Change the port=8080 value to port=80

    4) Save file.

    5) Stop your Tomcat and restart it.

    0 讨论(0)
  • 2020-11-22 17:38

    Just goto conf folder of tomcat

    open the server.xml file

    Goto one of the connector node which look like the following

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

    Simply change the port

    save and restart tomcat

    0 讨论(0)
  • 2020-11-22 17:43

    On a Linux Debian-based (so Ubuntu included) you have also to go to /etc/default/tomcat7, uncomment the #AUTHBIND=no line and set its value to 'yes', in order to let the server bind on a privileged port.

    0 讨论(0)
  • 2020-11-22 17:43

    If someone is looking for, how to change the tomcat port number in Eclipse IDE user following are the steps.

    1.In the Servers view, double click on the server name:

    2.That will open a configuration page for Tomcat as follows:

    3.Notice the port numbers are shown in the table on the right. Click to edit, for example:

    4.That will change port number for HTTP from 8080 to 80. Press Ctrl + S to save the change and restart the server. We can spot the change of port number in the Console view:

    This all content were taken from below link, please refer that link for further information thanks. http://www.codejava.net/servers/tomcat/how-to-change-port-numbers-for-tomcat-in-eclipse

    0 讨论(0)
  • 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
    
    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
    

    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
    
    0 讨论(0)
  • 2020-11-22 17:53

    On a linux server you can just use this commands to reconfigure Tomcat to listen on port 80:

    sed -i 's|port="8080"|port="80"|g' /etc/tomcat?/server.xml
    sed -i 's|#AUTHBIND=no|AUTHBIND=yes|g' /etc/default/tomcat?
    service tomcat8 restart
    
    0 讨论(0)
提交回复
热议问题