How to customize subdomains in custom apps

I have used frappe_docker to create a custom app with one site that has ERPNext, Helpdesk, and HRMS installed.

I want to implement subdomain-based routing within this single site. Specifically:

• The main website should be accessible at example.com.

• ERPNext should be accessible at erpnext.example.com.

• Helpdesk should be accessible at helpdesk.example.com.

• HRMS should be accessible at hrms.example.com.

I want to achieve this without creating multiple sites (i.e., one app per site). Instead, I want all apps to remain installed in the same site and be served via specific subdomains.

Is it possible to configure this within Frappe? If so, I’d greatly appreciate guidance or pointers to the right direction.

Thanks in advance!

Yes, it is possible to have all the applications in a single site instead of multiple ones and separate them using subdomains. To achieve this, you need to use ‘multi-tenancy,’ which is exactly what you’re describing.

Can you give some steps to achieve this?

Why not do this using the reverse-proxy?

Do you use NginX or Traefik?

1. Enable DNS Multi-Tenancy

bench config dns_multitenant on

2. Add Domain to Site

setup add-domain {domain-name} --site {site-name}

3. Update NGINX Configuration & Restart

bench setup nginx

sudo service nginx restart

4. Access Site Using Domain

Note (for local development only): If you’re testing on your local machine without DNS, map the domain to 127.0.0.1 by adding this to /etc/hosts :

127.0.0.1 {site-name}