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!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.