I m creating a simple web server in Ruby, which display s the text LOLZ in the browser. I have this now:
#!/usr/bin/ruby
require socket
server = TCPServer.open(2000)
loop do
client = server.accept
client.puts "HTTP/1.1 200 OK
"
client.puts "Content-type: text/plain
"
client.puts "
"
client.puts "LOLZ"
client.close
end
This works as expected. However, I want it to work on port 80. Whenever I change 2000 to 80, and start the server using bash, I get this error:
unknown-00-25-4b-8c-b9-b3:rServe koningbaardxiv$ ./rServe.rb
./rServe.rb:4:in `initialize : Permission denied - bind(2) (Errno::EACCES)
from ./rServe.rb:4:in `open
from ./rServe.rb:4
Can anyone help me? Thanks
EDIT: I just figured out that this is for all ports within a range of 0 to 999 :S