Reputation: 132
Unable to connect to the Rails server on ipaddress:3000. Port 3000 is open on the server. The initial http get from the browser is reaching port 3000, evident from tcpdump.
But no activity in the WEBrick console, stops right here -
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-01-15 15:43:07] INFO WEBrick 1.3.1
[2015-01-15 15:43:07] INFO ruby 2.2.0 (2014-12-25) [x86_64-linux]
[2015-01-15 15:43:07] INFO WEBrick::HTTPServer#start: pid=3072 port=3000
No obvious error messages from RVM or Rails.
The browser is giving "This webpage is not available." Error code: ERR_CONNECTION_REFUSED
rvm info -
ruby-2.2.0:
system:
uname: "Linux <> 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux"
system: "centos/6/x86_64"
bash: "/bin/bash => GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.26.9 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
updated: "43 minutes 5 seconds ago"
path: "/home/deploy/.rvm"
ruby:
interpreter: "ruby"
version: "2.2.0p0"
date: "2014-12-25"
platform: "x86_64-linux"
patchlevel: "2014-12-25 revision 49005"
full_version: "ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]"
homes:
gem: "/home/deploy/.rvm/gems/ruby-2.2.0"
ruby: "/home/deploy/.rvm/rubies/ruby-2.2.0"
binaries:
ruby: "/home/deploy/.rvm/rubies/ruby-2.2.0/bin/ruby"
irb: "/home/deploy/.rvm/rubies/ruby-2.2.0/bin/irb"
gem: "/home/deploy/.rvm/rubies/ruby-2.2.0/bin/gem"
rake: "/home/deploy/.rvm/rubies/ruby-2.2.0/bin/rake"
environment:
PATH: "/home/deploy/.rvm/gems/ruby-2.2.0/bin:/home/deploy/.rvm/gems/ruby-2.2.0@global/bin:/home/deploy/.rvm/rubies/ruby-2.2.0/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/deploy/.rvm/bin:/home/deploy/.rvm/bin"
GEM_HOME: "/home/deploy/.rvm/gems/ruby-2.2.0"
GEM_PATH: "/home/deploy/.rvm/gems/ruby-2.2.0:/home/deploy/.rvm/gems/ruby-2.2.0@global"
MY_RUBY_HOME: "/home/deploy/.rvm/rubies/ruby-2.2.0"
IRBRC: "/home/deploy/.rvm/rubies/ruby-2.2.0/.irbrc"
RUBYOPT: ""
gemset: ""
Default Gemfile -
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'execjs'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
What I did to configure the rails server -
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable --ruby
source ~/.rvm/scripts/rvm
sudo yum install -y sqlite-devel.x86_64 libdbi-dbd-sqlite.x86_64 libxml2-devel.x86_64 libxslt-devel.x86_64 sqlite-devel
curl -sL https://rpm.nodesource.com/setup | bash -
yum install -y nodejs
yum groupinstall 'Development Tools'
wget http://nodejs.org/dist/node-latest.tar.gz
tar xvfvz node-latest.tar.gz
cd node-v0.10.35
./configure
make
sudo make install
sudo yum install -y postgresql.x86_64 postgresql-devel.x86_64 postgresql-libs.x86_64
gem install rails
gem install sqlite3
rvm 2.2.0 do gem install jquery-rails
rails new <test_app>
rails server
A simple javascript server works on the same system. So not an OS config / firewall issue.
Also, same behavior with Ruby 2.1.5 and 2.0.0, with Rails 4.2.0 and latest stable RVM.
Upvotes: 2
Views: 2386
Reputation: 132
This works -
rails server -b 0.0.0.0 -p 3000
Found the solution here, once the problem was properly defined -
https://serverfault.com/questions/625841/cant-access-ports-assigned-to-rails-4-2-but-4-04-works-fine
Upvotes: 8