How to start thin on the default port?

mko picture mko · Feb 24, 2011 · Viewed 22.9k times · Source

I'm learning thin server, by now I can use thin start to fire up the server, but the port is 3000, I should type the localhost:3000 in the browser to get the webpage.

I want to take off the 3000 port as we normally do with other site. So I set use the command thin -p 80 start to use the default http port. But I got this error:

root@makserver:~/apps/videosite# thin --port 80 start
>> Using rack adapter
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:80, CTRL+C to stop
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_tcp_server': no acceptor (RuntimeError)
    from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_server'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/backends/tcp_server.rb:16:in `connect'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:49:in `block in start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
    from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
    from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
    from /usr/local/bin/thin:19:in `load'
    from /usr/local/bin/thin:19:in `<main>'

Answer

Simon Perepelitsa picture Simon Perepelitsa · Feb 24, 2011

This indicates the port might be already in use.

Also, try running it with administrator privileges

sudo thin start -p 80

(Thanks to Tom Crinson for his blog article.)