ruby-on-railsdiaspora

Unable to bind port 80 for Diaspora


I get this error while executing the ./script/server command.

Though, I can run it on other ports, I want to run Diaspora on port 80.

FATAL -- : error adding listener addr=0.0.0.0:80 23:14:23 web.1 | /home/diaspora/.rvm/gems/ruby-2.0.0-p353@diaspora/gems/unicorn-4.8.0/lib/unicorn/socket_helper.rb:185:in `bind': Permission denied - bind(2) (Errno::EACCES)

Please help me in solving this. Thanks in Advance!!


Solution

  • Don't.

    Ruby application servers aren't as hardened as common webservers/reverse proxies. Nor is Diaspora. The potential for security flaws is much higher here, possibly compromising your whole server if run as root. This is just inherently bad practice.

    It's further bad practice since most Ruby application servers don't handle HTTPS and even if they do is preferably done by more wide used software such as aforementioned webservers/reverse proxies.

    So instead run Apache or Nginx on port 80. You can find an example configuration for Apache here and one for Nginx here.

    As a general advice don't run anything as root unless you can explain why it has to be done and why there's no way around and why there can't be an alternative. Or if you're explicitly told to do so by somebody who can.