I have a service example.com
that needs to allow users to host a few files in their own subdomain userpage-userabc.example.com
, similarly as does Github with userabc.github.io
.
I currently use Apache, and each time I want to configure a new domain or subdomain, I have to create manually a new <VirtualHost>
, restart the Apache server, etc.
This is not possible here.
Example: if a visitor creates a new account userabc
(added in a database), how to make that the userpage-userabc.example.com
subdomain is available, and automatically serving files from /www/userabc/
or serving http://userpage-userabc.example.com/
with /www/main/index.php?user=userabc
?
Note: *.example.com
already has a wildcard A DNS-record to redirect to my server
What's a simple lightweight tool to do this "dynamic subdomain creation"? (I currently use Apache, PHP, Python, but I can use other tools).
Or is it possible with a single <VirtualHost>
that catches all sudomains *.example.com
and a RewriteRule including the subdomain?