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

  • Posted on May 22, 2014
  • TintinAsked by Tintin


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 #<Process::Status: pid 5275 exit 1> worker=1 I, [2014-05-22T14:04:32.974017 #4751] INFO – : worker=1 spawning… E, [2014-05-22T14:04:32.977238 #4751] ERROR – : reaped #<Process::Status: pid 5273 exit 1> 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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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?

Hey Andrew, <br> <br>Yes, indeed, it’s still the same issue. <br> <br>I basically followed this tutorial and didn’t do any changes to the configuration files generated by the 1-click-installation: <br> <br>This would be my /home/unicorn/unicorn.conf: <br> <br>listen “” <br>worker_processes 2 <br>user “rails” <br>working_directory “/home/rails” <br>pid “/home/unicorn/pids/” <br>stderr_path “/home/unicorn/log/unicorn.log” <br>stdout_path “/home/unicorn/log/unicorn.log”

Hey Timo, <br> <br>Is this still the same issue as in: <br> <br> <br> <br>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?