Change default port of tomcat to 80 or any port.

Change default port of tomcat to 80 or any desire port:-

Most of user want to change this default port to 80. Port 80 is by default using for web site.
Kindly go through below step and change the port.

STEP 1:- Stop the tomcat service.
[root@localhost ~]# service tomcat6 stop

STEP 2:- Find the tomcat path, Defalut tomcat6 path is /etc/tomcat6/. There is configuration file by name server.xml.

STEP 3:- Run the below commands one by one.
[root@localhost ~]# sudo sed -i 's/port="80"/port="8080"/' /etc/tomcat6/server.xml

[root@localhost ~]# sudo sed -i 's/port="443"/port="8443"/' /etc/tomcat6/server.xml

Http default port is 8080 and Https default port is 8443. You have change it to 80 and 443 respectively.

You can also change this to any desire port. e.g. for http is 123 and https is 456. Then you run the below command as.

[root@localhost ~]# sudo sed -i 's/port="123"/port="8080"/' /etc/tomcat6/server.xml

[root@localhost ~]# sudo sed -i 's/port="456"/port="8443"/' /etc/tomcat6/server.xml

STEP 4:- Start the tomcat service as below.
[root@localhost ~]# service tomcat6 start.

STEP 5:- Check port 80 is listening or not using below command.
[root@localhost ~]# netstat -ano | grep :80

Also before changing tomcat port you make sure that on port 80 or desire port is not in use...