Getting Time-out error when trying to deploy Rails 4 app on Nginx

Posted May 22, 2014 5.1k views
Hello, I am trying to deploy my first Rails application but I am getting this in the browser: "504 Gateway Time-out, nginx" In the unicorn error log it says: E, [2014-05-22T14:04:32.973757 #4751] ERROR -- : reaped # worker=1 I, [2014-05-22T14:04:32.974017 #4751] INFO -- : worker=1 spawning... E, [2014-05-22T14:04:32.977238 #4751] ERROR -- : reaped # worker=0 I, [2014-05-22T14:04:32.977461 #4751] INFO -- : worker=0 spawning... I, [2014-05-22T14:04:32.978600 #5279] INFO -- : worker=1 spawned pid=5279 I, [2014-05-22T14:04:32.984604 #5281] INFO -- : worker=0 spawned pid=5281 I, [2014-05-22T14:04:32.995264 #5279] INFO -- : Refreshing Gem list I, [2014-05-22T14:04:33.000778 #5281] INFO -- : Refreshing Gem list What does this mean and how can I get my app working?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers
Hey Timo,

Is this still the same issue as in:

Let's try and gather some more information to help debug this. How are you running your app? Could you post your Nginx configuration? Any application specific configurations?
Hey Andrew,

Yes, indeed, it's still the same issue.

I basically followed this tutorial and didn't do any changes to the configuration files generated by the 1-click-installation:

This would be my /home/unicorn/unicorn.conf:

listen ""
worker_processes 2
user "rails"
working_directory "/home/rails"
pid "/home/unicorn/pids/"
stderr_path "/home/unicorn/log/unicorn.log"
stdout_path "/home/unicorn/log/unicorn.log"

I came across a very similar issue, and here’s what worked for me:

When I used the one-click Rails creation, it defaulted to Ruby 2.0.0. I used RVM commands to change this to 1.9.3. Changing it back to 2.0.0 as the default, re-running bundle install (and the whole kit and kabootle of “bundle exec rake db:migrate”, “bundle exec rake assets:precompile”), and restarting the Unicorn service (“service unicorn restart”), the 504 error was gone!

I don’t have anything really holding me back to 1.9.3, so for me, I can just update my development environment to match. I’m not sure what the solution would be otherwise.. perhaps building the RoR environment from scratch on a fresh Ubuntu droplet, vs using the one-click option?