Two sites on one Rails droplet

July 22, 2014 746 views

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


1 Answer

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.

Have another answer? Share your knowledge.