Tomcat7 : How to start on port 80

Posted: June 13, 2013 in linux, tomcat, ubuntu, wso2
Tags: , ,
  • Configure tomcat7 to start on port 80

Open /etc/tomcat7/server.xml and locate to the following lines

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

Change the port value to 80 as below.

<Connector port="80" protocol="HTTP/1.1"
redirectPort="8443" />
  • Start the tomcat7 as root user

After configuring tomcat7 to start on port 80, if you start the tomcat7 you will get errors in /etc/log/catalina.log file as below

SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-80"] Permission denied <null>:80
at org.apache.coyote.AbstractProtocol.init(
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(

The reason for above error is only root users have the permission to start applications on port 80. So lets configure tomcat to start with rot privileges.
So open the file /etc/init.d/tomcat7 and locate to

# Define the tomcat username

Then change the TOMCAT_USER to root as below.

# Define the tomcat username

Please note that the location of the tomcat7 file is dependent of the OS.
Debian wheezy – /etc/default/tomcat7 instead of /etc/init.d/tomcat7
Ubuntu 13.04 – /etc/init.d/tomcat7
Ubuntu 14.04 – /etc/default/tomcat7

Those locations were reported by the viewers commented below

  • Restart the tomcat7
sudo service tomcat7 status

If everything is fine, you will get an output similar to

tomcat7 (pid  24215) is running…

  • Verify tomcat7 running on port 80

You can get the pid of the tomcat7 process from the output of above command which is 24215 in mycase. Using the netstat command you can view what are the ports our tomcat7 process is running on.

sudo netstat -tulpn | grep 24215

If tomcat7 is started on port 80, you will get and output like below.

tcp        0      0 :::80                       :::*                        LISTEN      24215/java

  1. I am running debian wheezy and discover that I needed to edit /etc/default/tomcat7 instead of /etc/init.d/tomcat7

  2. Hi Ruut,

    Thanks for sharing your finding. I haven’t tried this on Debian.

  3. Jk says:

    Sorry but, this is a BIG SECURITY PROBLEM, tomcat runs as tomcat user, and should NEVER run as root, otherway any visitor of your website has root privileges…
    You should remove this post or modify it !!

  4. srikanth says:

    helped me…thanks

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s