Reputation: 2837
I'm new to Ruby on Rails and helping on an existing project. I ran rails server, and received the following output
=> Booting Unicorn
=> Rails 4.2.5.2 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
I, [2016-12-05T13:44:05.166061 #15228] INFO -- : listening on addr=0.0.0.0:8080 fd=11
I, [2016-12-05T13:44:05.185700 #15228] INFO -- : master process ready
I, [2016-12-05T13:44:05.187404 #15242] INFO -- : worker=0 ready
I, [2016-12-05T13:44:05.187827 #15243] INFO -- : worker=1 ready
I, [2016-12-05T13:44:05.188412 #15244] INFO -- : worker=2 ready
^CI, [2016-12-05T13:45:11.233928 #15228] INFO -- : reaped #<Process::Status: pid 15244 exit 0> worker=2
I, [2016-12-05T13:45:11.234060 #15228] INFO -- : reaped #<Process::Status: pid 15243 exit 0> worker=1
I, [2016-12-05T13:45:11.234227 #15228] INFO -- : reaped #<Process::Status: pid 15242 exit 0> worker=0
Which seems to indicate that the server is up and running. However, I am unable to connect to http://localhost:3000, it gives me an error connection refused. Does anybody know how I can go about debugging this?
Upvotes: 3
Views: 3183
Reputation: 920
Try checking your hosts file.
Linux /etc/hosts
Windows c:\Windows\System32\drivers\etc\hosts
and editing the localhosts to serve 127.0.0.1. or move it so it is last. Rails will take the last mention of localhost and use it.
Or you can go even deper and try using telnet localhost 3000
to tell if the port is unavailable at the TCP level.
My hosts file looks something like
127.0.0.1 localhost
127.0.1.1 myPC
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
Upvotes: 0
Reputation: 1096
With rails 4.2.0, the server binds to localhost by default, instead of 0.0.0.0. When working with a rails in a virtual box, accessing the server from the host computer, the binding address needs to be 0.0.0.0
Start rails server with -b0.0.0.0 to make the rails server accessible from the host computer/browser.
http://guides.rubyonrails.org/4_2_release_notes.html#default-host-for-rails-server https://github.com/samuelkadolph/unicorn-rails/issues/12#issuecomment-60875268
or try passing different port
rails s -p 3001
Upvotes: 1