0

I have a machine running CentOS 7 and TomCat 8 as webapp server for Java appl. And I need TomCat to listen to the default port 80. For now I can access my website via http://example.com:8080 Here what i've done. My TomCat is running as a service with a user especially created for it with no root privileges. In server.xml I added following:

<Host name="example.com" appBase="example" unpackWARs="true" autoDeploy="true">
    <Alias>www.example.com</Alias>
    <Context path="" docBase="example" debug="0" privileged="true" />
    <Valve className="org.apache.catalina.valves.AccessLogValve"
         directory="logs"   prefix="localhost_access_log." suffix=".txt"
         pattern="%h %l %u %t &quot;%r&quot; %s %b" resolveHosts="false" />
</Host>

That got rid of the annoying http://example.com:8080/expamle . Now I need to get rid of port 8080, so that I can access it just by www.example.com . I know the problem and a few ways to fix it. Linux can't bind to ports <1024 with no root privileges. You can use authbind, but it seems it is only for Ubuntu. There are some equivalents to work with CentOS, but I rather not use them. Also I can put Apache in front of TomCat as proxy server, but let that be the final solution if nothing else helps. Also I can redirect requests from port 80 to 8080, but the user can see the port nr in url. Is there any other solution you know of. It'll be really helpful to know. Otherwise I think I'll just stick with the Apache proxy server plan. Thank you.

The possible duplicate question has all answers related to Linux Debian-based systems. I run CentOS, so I can't do that.

Dinjvald
  • 71
  • 1
  • 4
  • 1
    related: [How to change the port of Tomcat from 8080 to 80?](http://stackoverflow.com/a/13586503/1983854) – fedorqui May 13 '16 at 14:28
  • You seem to have enumerated the options pretty well; run as root (perhaps in a chroot or an authbind context) or use a reverse proxy. Those are indeed your choices. – Elliott Frisch May 13 '16 at 14:29

0 Answers0