How to change Port 8080 on Apache Tomcat on Linux Centos 6.5 server to the Default?

25,839

Solution 1

I had the same problem. It means I need to change port number from 8080 to 80 so that I can access my url (e.g www.mydomain.com) without appending 8080. But I found a different way to solve the problem. Instead of changing port number in server.xml. I redirected port number 80 to 8080 using the following script. This works perfectly fine for me.

[root@myroot ~]# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
[root@myroot ~]# iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080

Please find more at this link

Solution 2

taken from here

in your tomcat install dir, look for server.xml file.

change

<Connector port="8080" ...

to

<Connector port="80" ....

or any other port (80 is the default without specifying port)

don't forget to restart tomcat to apply changes

sudo service tomcat7 restart
Share:
25,839
Mukesh Nandeda Dhakad
Author by

Mukesh Nandeda Dhakad

Updated on July 09, 2022

Comments

  • Mukesh Nandeda Dhakad
    Mukesh Nandeda Dhakad almost 2 years

    I want to remove switch from port 8080 on my Apache Tomcat on Linux server CentOS 6.5 to the default. On My hosted Apache Tomcat server is running on port 8080 on url vmx15978.hosting24.com.au:8080. After I have installed the Geoserver software on the Apache server the url for it is http://vmx15978.hosting24.com.au:8080/geoserver/web/.

    My website domain is links-map.com. Currently I can access Geoserver by this URL: links-map.com:8080/geoserver/web; However, I want to access Geoserver without 8080 using this URL instead: http://links-map.com/geoserver/web/

  • Mukesh Nandeda Dhakad
    Mukesh Nandeda Dhakad about 10 years
    Thanks Jossef I try this
  • Mukesh Nandeda Dhakad
    Mukesh Nandeda Dhakad about 10 years
    I have change port 8080 to 80 on <Connector port="80" .... But nothing is found on vmx15978.hosting24.com.au my tomcat server is 7.0.42
  • Atul Chavan
    Atul Chavan almost 7 years
    thank a lot dear friend. i was strugling really hard for this. a simple trick of changin 8080 to 80 worked for me