Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm aware of the implications of running tomcat on port 80, but I'm after a quick solution. I'm trying to follow this tutorial. I've followed the tutorial with two changes:

  • tomcat6 is user name tomcat is run as
  • The location of tomcat conf file: /usr/share/tomcat6/bin/catalina.sh

But I'm still getting permissions errors. Java is saying its unable to bind to port 80. What else should i be doing? What other information should i provide for people to debug? Just to confirm, there's nothing else running on port 80

share|improve this question
    
and you are doing this with root privileges? –  Thomas Nov 30 '11 at 21:12
    
how do you mean? im logged in as root when configuring the server? –  richzilla Nov 30 '11 at 21:23
    
No, when starting the server. In the tutorial it is this part: sudo /etc/init.d/tomcat6 restart –  Thomas Nov 30 '11 at 21:33
    
yes, im logged in as root when i restart the server (so i dont need the sudo part) –  richzilla Nov 30 '11 at 21:37
add comment

3 Answers 3

You can change AUTOBIND property of /etc/default/tomcat6 to "yes" as follows:

AUTHBIND=yes

Restart your tomcat and that will enable you to use available privileged port (1-1023).

share|improve this answer
    
I done that thing as well. Still not getting. @richzilla : if your code is working please let me know and mark this one as verified so that we can discuss further on this answer. –  sumitramteke May 23 at 5:30
add comment

There are two different ways of doing this without actually touching the tomcat config.

You can make an iptables script that redirects traffic from port 80 to port 8080 (then you dont need to fiddle around with tomcat settings)

for iptables

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8080 -j REDIRECT --to-port 80 would do the trick! (make a script so its done automatically on uppstart

or you can create a Apache reverse proxy that actually proxies the connections to your tomcatserver through it (this is good since it can actually cache request and speed up connections for you)

share|improve this answer
    
Shouldn't 8080 and 80 port should be switched in the provided script? i.e. iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 –  Yura Jan 20 at 18:14
add comment

In the Tomcat HTTP connector, make sure your connector on port 80 is binding to ALL interfaces, or 0.0.0.0 , rather than just 127.1 . That might explain why your not able to connect with a url such as http://10.0.0.2:80 but you can with http://127.1:80

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.