Starting Rails Server in a different project directory

Posted September 26, 2018 1.5k views
Ruby on RailsUbuntuDigitalOcean 1-Click Apps MarketplaceUbuntu 16.04

I’m using Digital Ocean’s One-Click Install Apps feature to simplify starting a VM with Ruby on Rails pre-installed.

Right off the bat, it generates \home\rails\rails_project as a starter Ruby on Rails web application to verify everything is running like normal.

However, I want to build a separate Ruby on Rails web application project within the home directory and initialize rails server there instead of the pre-configured \home\rails\rails_project

I’ve edited /etc/nginx/sites-available/rails and /etc/unicorn.conf to point to my new project directory. I’ve also restarted nginx service, restarted unicorn service, but when I start rails server, I keep getting a 502 Bad Gateway or ‘This site can’t be reached’ error when I attempt development mode with :3000. I don’t have a problem when I restore to default values, bundle install in \home\rails\rails_project and start rails server there.

Is there a step I’m missing?

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
1 answer

I would check this:

  1. Ownership and permission of your new project directory (chown -R rails.rails)

  2. Check the unicorn log for clues (/var/log/unicorn/unicorn.log)