How do I get Ruby on Rails 5.2 to work with Nginx?

Posted December 30, 2018 3.1k views
Ruby on RailsNginxMySQLUbuntu 18.04

I have tried basically everything to get my website Duelingpets to work with the new version of rails but each time it is continously failing. I tried to get it working on Apache but it kept displaying index of / instead. I tried to get it working with nginx on its own but it only displayed the nginx welcome screen instead of ruby. I have tried nginx with passenger and that was equally a failure as well.

What am I doing wrong and why does this continue to not work?
I have followed all the digital ocean tutorial steps but none of them seem to actually fix things. I have yet to get an answer or solutions to this problem and I been creating several different droplets just to find out how to get it to work. Why is it that Rails 5.2 plays perfectly well with my linux laptop but if I try to get it working with an ubuntu server on digital ocean it completely fails? Why????????

I am kind of at a loss as to why this is happening.
Can someone please help me to solve this issue as I want to have my site up and running on the newer version without having to rely on my older version.

Here are the guides I used for the work:

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

It reads like you’ve had many stabs at this and are fed up with how things are going. But some things require a closer look to get them ironed out. Why don’t you set things up per the tutorial with your Rails app and I’ll take a look at whatever issue you’re still having.


You need to edit the rails.service file to set the ‘default’ site

Description=ExampleApp <– change this to Duelingpets

WorkingDirectory=/home/rails/example/ <– change this to the new path
ExecStart=/bin/bash -lc 'bundle exec puma’