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

Jmrtech's avatar

Subdomain for multiple tenants, single code base

I just started using forge about a week ago, and I am trying to understand how the subdomains should be setup. If all the sites are using the same code base should I still create a subdomain for each tenant? Right now I have an A record from my hosting site that points to the public folder on the forge server. tenant1.main.com ----> /public on forge tenant2.main.com ---> /public on forge Not sure if this is the correct setup.

0 likes
2 replies
bashy's avatar

Looks fine. For Nginx to pick up and respond to the requested host/domain you need to have it in the server_name setting. You can direct multiple to the same root directory.

xsmalbil@icloud.com's avatar

I hope I understood you, so this is my answer to how I interpreted your question: How tenants connect to your site is up to you. It's more a thing for the eye.

The following setup's do not say anything about the site's internal architecture;

  1. tenant1.domain.com/about-us and tenant2.domain.com/about-us
  2. www.domain.com/tenant1/about-us and www.domain.com/tenant2/about-us
  3. www.tenant1.com/about-us and www.tenant2.com/about-us

They could still have the same internal workings and link to the same site.

Please or to participate in this conversation.