Report this

What is the reason for this report?

502 Bad Gateway on one-click Ruby Rails app

Posted on December 25, 2016

Hi I’ve been following the deploy your rails app with one click. I’ve tried to deploy my rails app after many several attempts. Any idea what I might be missing or doing wrong? I’ve been following the “How to Use the Ruby on Rails One-Click Application on DigitalOcean” very closely. Thanks!

when I run sudo tail -30 /var/log/nginx/error.log I get

2016/12/24 22:45:39 [error] 19842#0: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 99.57.138.78, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "192.241.137.121"
2016/12/24 22:48:21 [error] 21366#0: *23 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 99.57.138.78, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "192.241.137.121"
2016/12/24 22:49:10 [error] 21366#0: *25 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 99.57.138.78, server: _, request: "GET /todo_lists/index HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/todo_lists/index", host: "192.241.137.121"
2016/12/24 22:50:42 [error] 21366#0: *28 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 99.57.138.78, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "192.241.137.121"
2016/12/24 22:55:17 [error] 21366#0: *31 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 99.57.138.78, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "192.241.137.121"
2016/12/24 22:55:57 [error] 21366#0: *31 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 99.57.138.78, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock:/", host: "192.241.137.121"


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!

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.

First make sure Unicorn is running. Verify it’s service by running:

  1. sudo systemctl status unicorn

You should see there running somewhere.

Beside that you can take a lot at Unicorn logs which should be located in /var/log/unicorn/unicorn.log.

If everything is OK, we will try to find more clues. =)

The developer cloud

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

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.