How to organize subdomains on my project?

Hello everyone,
I want to understand how I can setup different subdomains for different user groups. Project that I am working on is a type of marketplace, where two different user groups (company and customer) needs to have different subdomains to access to the app, such as;

I’ve read about using Virtual Host on Apache, and a lot of related discussion on stackoverflow but I cant seem to wrap my head around this.

I understand that I need to first add CName record through my domain registrar, then VirtualHost block for each subdomain to the httpd.conf file and point to the document root.

How this virtualhost block should look like and how my project folder should be setup? Any direction would be greatly appreciated.

Thanks.

Edit: I use docker containers for environment and DigitalOcean for hosting.

Community Page
Last updated: