Report this

What is the reason for this report?

Rails app only working over WEBrick, not Nginx?

Posted on September 15, 2013

Following the tutorial on launching a Rails app with Nginx and Unicorn here: https://www.digitalocean.com/community/articles/how-to-launch-your-ruby-on-rails-app-with-the-digitalocean-one-click-image

Once I went through the whole tutorial, I try to visit my app on port 80 with the IP address for my Droplet, and all I get are 504 time outs. I tailed Unicorn and got this:

root@blog:/home/rails# tail -40 /home/unicorn/log/unicorn.log /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in specs' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in specs_for’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in requested_specs' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in requested_specs’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in setup' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:120:in setup’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in <top (required)>' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in require’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in rescue in require' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in require’ /home/rails/config/boot.rb:6:in <top (required)>' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' /home/rails/config/application.rb:1:in <top (required)>’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require’ /home/rails/config/environment.rb:2:in <top (required)>' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' config.ru:4:in block in <main>’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in instance_eval' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in initialize’ config.ru:1:in new' config.ru:1:in <main>’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn.rb:48:in eval' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn.rb:48:in block in builder’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:722:in call' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:722:in build_app!’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:595:in init_worker_process' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:615:in worker_loop’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:500:in spawn_missing_workers' /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:511:in maintain_worker_count’ /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:277:in join' /usr/bin/unicorn:121:in <main>’ E, [2013-09-15T01:13:06.115978 #24715] ERROR – : reaped #<Process::Status: pid 22920 exit 1> worker=1 I, [2013-09-15T01:13:06.116156 #24715] INFO – : worker=1 spawning… I, [2013-09-15T01:13:06.117254 #22926] INFO – : worker=0 spawned pid=22926 I, [2013-09-15T01:13:06.120449 #22928] INFO – : worker=1 spawned pid=22928 I, [2013-09-15T01:13:06.131898 #22926] INFO – : Refreshing Gem list I, [2013-09-15T01:13:06.135844 #22928] INFO – : Refreshing Gem list

When I execute “rails s -e production” the app runs fine in WEBrick, so I have to assume it must be Unicorn or Nginx causing the problem. Any advice? I’m new to both Unicorn and Nginx.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.