How to install Ruby on Rails onto an existing Apache server?

Posted July 9, 2019 7k views
Ruby on RailsMySQLApachePHPLAMP StackAPIUbuntu 18.04

So I’ve had a webserver with Ubuntu and Apache on the LAMP stack for about a year. It’s mainly just a portfolio website.

I’ve just made an API using Ruby on Rails that is on my local machine and I’ve read up that you can host multiple different applications on the same droplet.

The idea is to make a subdomain such as
My existing website I have is
With this subdomain I wish to host my Ruby on Rails API, it uses PHP myadmin which I think I’ll have to install on the LAMP stack? And it also has gems to install such as mysql2.

My question is how do I do this?

I’ve looked at so many tutorials but they’re all saying a different thing and mentioning Nginx and I don’t know how to get a subdomain. I bought my domain from Google so do I do it on Google Domains or do I do it on Digital Ocean?

So altogether I’m asking how to…
Make a subdomain such as
Do I install PHPmyadmin on the main Apache bit and will it be on both my subdomain and main domain?
Is it possible to have a Ruby On Rails app and an existing Apache web server working concurrently?
How do I move my API from my PC over? Is it simply a case of copying over files? (To the Sites folder I’m guessing?)
How would I start it? (The usual rails s? or is it slightly different cause of the sub domain?
MySQL is already installed through the LAMP stack so I can just forget about it right?

Is that everything? It’s been a good 7 months since I actually went on my server terminal so I’m probs a bit rusty with the commands.

Thanks in advance, I know I’m pretty bad at explaining myself but I think I did an alright job

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


Yes, all the above is possible, you can run Ruby on Rails onto an existing Apache server and you don’t need Nginx server. Here’s a guide on how to set that all up:

Before you start with the guide you can point your subdomain name to your Droplet’s IP address. If you are using Google’s namesevers you need to do that via your Google account, if you are using DigitalOcean’s nameservers you need to make this DNS change via your Digital Ocean domain control panel.

Also before you proceed with the rails setup make sure to backup your droplet, in case that anything goes wrong, you can simply revert to that backup.

Regarding the PHPmyAdmin installation you can follow the steps here on how to install PHPmyAdmin manually with an existing Apache server, start from step Step 3:

Hope that this helps! Let me know if you need any help!


by Juraj Kostolanský
In this tutorial, we will demonstrate how to install [Phusion Passenger]( as your Rails-friendly web server, which is easy to install, configure, and maintain. We will integrate it into Apache on Ubuntu 14.04. By the end of this tutorial, we will have a test Rails application deployed on our Droplet.