Skip to content

Apache httpd vs. Tomcat 7: port 80 vs. port 8080

I had recently installed Tomcat 7 on Amazon ec2. I found that Tomcat, by default, listens on port 8080.

The documentation on the internet advocates that this is because linux is better saving the lower ports to the super user. (The solution on ec2 btw is creating a Load Balancer – directing the communications from port 80 to port 8080 on the target machine)

Than – to my surprise – I went on and installed an Apache server on another machine (yum install httpd), and surprise! – Apache listens on port 80 by default!

This is awkward i thought… where are the ‘port 8080’ advocates now?

can anyone please explain the conceptual difference?




The difference is mostly historical at this point, but still enforced by Linux and most Unix implementations that I can think of. Unix/Linux considers any port number < 1024 to be “privileged” and requires root privs to bind to them. Any user should be able to bind to ports higher than 1024. If your software package is of a certain vintage it expects to be started as root, bound to a port, and optionally it will then change effective UID to a non-privileged user. Apache HTTPD falls into this category. Software packages created later on (ie Apache Tomcat) typically went the route of doing everything with a non-privileged user and binding to a higher port number by default.

Some firewall admins can, I’m sure, go into detail about how port < 1024 will sometimes get special treatment in firewall configurations in some cases.

User contributions licensed under: CC BY-SA
1 People found this is helpful