504 Gateway Time-out for Rails Application with Ubuntu, NGINX and Unicorn

December 21, 2014 2.9k views

I'm trying to deploy my first RoR app. I installed PostgreSQL, created database, cloned source code, bundled it and applied migrations. But I've got "We're sorry, but something went wrong". So I've decided to reboot it using DO instruction for safety rebooting. And now I'm getting 504 Gateway Time-out

Here is nginx error.log's tail

https://gist.github.com/femalemoustache/13089aad6c21f1e5934e

Here is unicorn.log's tail

https://gist.github.com/femalemoustache/3d6485b2586624154a42

What to do?

1 comment
3 Answers

Edit your /etc/nginx/nginx.conf and alter those parameters in the 'http' section (set timeouts according to your needs):
sendtimeout 120;
proxy
readtimeout 120;
proxy
connect_timeout 120;

and then restart nginx (service nginx reload)

that variables respond to gateway time limit, if it doesnt help - increase numbers

  • Thank you for your response. I tried it. But I don't think any value can resolve the problem. My app is lightweight and it should open pretty fast, not for 2 minutes. Looks like nginx doesn't get response from unicorn, but I don't know the reason.

Did you ever figure this out? I am running into this as well.

Have another answer? Share your knowledge.