Two sites on one Rails droplet

  • Posted July 22, 2014

Hi there, I’m trying to get two sites set up on one domain and thought I could ask for recommendations here as to where I might start.

Specifically, I need to point to a flat site somewhere (would /var/www be a good place to put it?) and to point to the rails site (which is effectively just a JSON api). All the DNS is set up and working.

Thanks in advance



Submit an 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.

You can put your static site in /var/www or any other place that is readable by your web server. I put mine in a user directory - generally /home/<user>/domains/<domain>/public_html is the pattern I use. All I need for SFTP access is to log in as that user. I suppose it’s a habit left over from my time on shared hosting, but it works, and simplifies things a little bit when I want to serve more than one site from that server.

Same thing for your Rails application.

For both, it’s just a matter of server configuration. The web root is wherever you put those files, and the web root is the public directory of your Rails application. There may be further configuration required if you’re using Nginx or Apache in front of your application.