[Ruby] Puma-Nignx environment to escape when rails s -e production -d fails

1 minute read


Deploy on EC2 with Rails6 + Puma + Nginx And in the terminal SSH connected to EC2

rails s -e production

Then the service is displayed without any problems

rails s -e production -d

Then an error screen is displayed?

Yeah-this keeps connecting to SSH to keep the service running

It is for you who have such a problem!


In config/puma.rb in the root folder of Rails



I will add it! with this

rails s -e production -d

Then I can not start it

rails s -e production

It will be daemonized, so it’s a solution!

This is inconvenient because it will be daemonized locally


if Rails.env =='production'

Let’s write! It’s a workaround that anyone can think of! Sorry for the inconvenience!


I haven’t completely investigated it, but as a result of becoming a net surfer and diving under the sea of google, it seems that puma.rb does not load when it is daemonized with “rails s -d” with puma. When I started with rails s -e production -d, I could not connect with the socket set in puma.rb in the error log of Nginx! Is listed, so I think it’s probably correct.

This is bad! Please point out any points!