Report this

What is the reason for this report?

Two sites on one Rails droplet

Posted on 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 example.com to point to a flat site somewhere (would /var/www be a good place to put it?) and api.example.com to point to the rails site (which is effectively just a JSON api). All the DNS is set up and working.

Thanks in advance

Daniel



This textbox defaults to using Markdown to format your 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 example.com web root is wherever you put those files, and the api.example.com 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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.