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;
- app.mydomain.com for companies which will manage their listings etc.
- www.mydomain.com for customers which will view listings, create account etc.
- admin.mydomain.com for admins to be able to manage the app
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.
Edit: I use docker containers for environment and DigitalOcean for hosting.