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

sirexzib's avatar

How to add a subdomain to an already existing site

So I got a site up using laravel forge and digital ocean and Gandi as domain provider. I also have cloudflare installed on the domain.

Now I would like to make an subdomain for it, preferably using the same laravel project as my main domain as so: api.mydomain.com

How would I do this? I didn't enable allow wildcard subdomains when I created it, do I do it somewhere in nginx?

So far I have created an A record on both DO, Cloudflare and Gandi that points to the servers IP.

I have also done this in route:

Route::domain('api.mydomain.com')->group(function () { return "hello"; });

To make it echo "hello" when visited, but I think I have missed something because it's not working.

Thanks.

0 likes
1 reply

Please or to participate in this conversation.