Hi all I'm trying to change the port number of my Tomcat server installed on Ubuntu. For this I have changed the file server.xml
and made the following changes:
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443" />
But the problem is that whenever I try to open the localhost:8081
it is working fine but when I tried to open localhost:8080
but it is still accessible. Can someone please explain why this is happening?
Secondly when I made the default port 80 then tried localhost:80
or localhost
then it was not accessible. Again, why is this happening?
As far as the listener still up on port 8080, you'll want to verify that there isn't a connector defined for that port, and that no other tomcat instances are running.
It's likely that the cause of the issue with port 80 is that low ports require root privileges to bind, and tomcat, by default, runs as a non-root user. The way to get around this is to use authbind.
Then, modify the config file for tomcat to enable authbind support.
I believe the setting for authbind is near the bottom of the file.
I tried this solution http://beginlinux.com/server/ubuntu/changing-the-port-on-tomcat and it worked for me. All you need to do is to confirm which ports are already in binding then change the port number in the server.xml file of tomcat. Then you need to restart tomcat to make sure change gets implemented.
Use redirect iptables rules:
better not to running Tomcat as root(80 port need root permission).
personally I change it in the /srv/apachexxx/conf (or wherever you installed it, inside the conf/ folder) in the file server.xml look for
and change the port. You also need to change the shutdown ports else you will get a warning, due you cant use same ports (in case you will have more than one tomcat running)