Question

Cannot run Sinatra application on port 80

I am trying to run some blog software I wrote on port 80 like this: ruby tinyblog.rb -o 80

Only problem is that I get this error: [2014-05-24 01:04:34] INFO WEBrick 1.3.1 [2014-05-24 01:04:34] INFO ruby 2.1.2 (2014-05-08) [x86_64-linux] /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:206:in bind': Permission denied - bind(2) for 127.0.0.1:80 (Errno::EACCES) from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:206:in listen’ from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:461:in block in tcp_server_sockets' from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:232:in each’ from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:232:in foreach' from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:459:in tcp_server_sockets’ from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/utils.rb:75:in create_listeners' from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:132:in listen’ from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:113:in initialize' from /home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:45:in initialize’ from /home/user/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in new' from /home/user/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in run’ from /home/user/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1497:in start_server' from /home/user/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1435:in run!’ from /home/user/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/main.rb:25:in `block in module:Sinatra

How do I fix this? The application can be found at http://github.com/Quojil/TinyBlog if need be.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Ensure that you are not running a web server that is already bound to port 80, and that you are running as a user with root privileges. Root privileges are required for binding to any port below 1024.