Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lmxdev's avatar

Hosting advice

I want to host 3 Laravel apps, on a single domain like such:

site1.mydomain.com
site2.mydomain.com
site3.mydomain.com

these application are not related, and they have their own databases.

I'd like to know what hosting is prefered for Laravel applications, and if that subdomain thing is possible? I've never deployed any Laravel apps to production so, I'm totally new to this.

Thanks

0 likes
11 replies
Screenbeetle's avatar

This is fine so long as you have a separate IP address for each subdomain

I've got a number of apps running with Digital Ocean and Forge. They all have at least one subdomain running off the same server typically:

staging.mydomain.com

www.mydomain.com

One has 4 subdomains - all with separate databases. You just need to set each one to have a separate DNS A Record. Doing it via Digital Ocean and Forge makes it very easy as you get a separate IP address for each site.

lmxdev's avatar

but i dont understand how that's possible they say on DigitalOcean that only one IP per droplet.. I don't want to pay 3 times...

getupkid's avatar

Why do you need separate IP's for each application? You don't. Each one can be a virtual host pointing to a different directory.

I am unfamiliar with DigitalOcean though so I won't be able to help you with specifics regarding that, but they should allow you.

Screenbeetle's avatar

@vapenation - yes you are totally correct. I've just logged in to a couple of my accounts and yes they are separate droplets (or servers on Forge). Please ignore my misinformation! I was confusing my vps accounts with Digital Ocean / Forge

willvincent's avatar

A single host is all you need for multiple domains/subdomains.. the only real limitation would be whether that host has enough resources to handle all the traffic you send to it.

For DNS you simply need a wildcard record that will send traffic trying to hit [anything].yourdomain.com to the same IP address. Then for the various subdomains, setup each app as a virtualhost entry with it's servername defined specifically: site1.yourdomain.com etc

You'll likely also want something to be defined as the default so that if no other vhost matches, you still get something -- alternatively you could set up another vhost that acts as a catch-all for any non-matched [sub]domain, and have it just respond with a 404, or something similar.

jlrdw's avatar

I ran across another good hosting co. a2 hosting, see if they can help https://www.a2hosting.com/

If you have 3 clients paying, I'd have 3 separate setups / domains. In long run less headache. It don't seem so now, but it will catch up to you later.

I don't want to pay 3 times...

If they are your apps and not Fedex size then yes have the sub domains. Or one site would do it with separate databases. I do that on Godaddy, just the first part looks the same in url, but you can have

  • site/myapp1
  • site/myapp2

Many ways to achieve this.

But if heavy traffic, I'd have separate sites.

Right now I have a laravel app and a custom framework app on godaddy, but small sites, no heavy traffic.

lmxdev's avatar

thanks for your responses, I forgot to mention that there will hardly be any traffic, it's just to show applications in production

Screenbeetle's avatar

Hi again @vapenation

After thinking I was going senile my colleague reminded me of the project that had multiple subdomains running off one digital ocean droplet.

I no longer have access to it so can't check exactly how it was set up. My colleague though is pretty sure it was very straightforward. We just:

  1. Set up one server through forge (one ip address)
  2. Set up each subdomain as a separate site on the one server (ensuring you don't check the 'Allow Wildcard Sub-Domains' option)
  3. Then just created A records for each subdomain - each pointing to the same ip address

After that we think it just worked straight off the bat with no special virtualhost config.

To be doubly sure I just ran a test using my own domain and two A records in Cloudflare. Following the above steps I just created these two static subdomains (no databases or Laravel install but the theory should be the same):

http://subdomain1.screenbeetle.co.uk/

http://subdomain2.screenbeetle.co.uk/

Hope that helps

Screenbeetle's avatar

Does anyone know of any dodgy knock-on effect using this approach?

lmxdev's avatar

@Screenbeetle thank you for your insights, one thing though, not sure if i'm required to use Forge? What are the benefits? I am trying to keep the cost to a minimum.

Please or to participate in this conversation.