I would like to be able to create and remove subdomain name dynamically using scripting languages such as PHP, Python, Perl or others. I am using Apache as a web server
Example:
http://subdomain.example.com
http://subdomain2.example.com
thanks
|
feedback
|
|
You can make a CNAME entry/ A Record in your DNS settings, for each subdomain
To automate it along with registration, you can write a script which is executed for each user, when s/he registers. You can refer to this link, as well, for a step-by-step process for Apache: How to setup subdomains in apache Alternate Solution You can also refer to an easier wildcard solution, given by Alnitak.
| |||
|
feedback
|
|
The creation of subdomains is built into Apache, look into mass vhosting. Specifically: http://httpd.apache.org/docs/2.0/vhosts/mass.html All you'll need to do then is come up with a convention, and then have your script create directories when needed. But, technically you want to start with the apache mass vhost configuration setup. | |||||
feedback
|
|
Don't actually create the subdomains, but instead just use a wildcard subdomain so you can have http://anything.example.com. | |||
|
feedback
|
|
This is actually a DNS question, not an Apache one unless you have a *.example.com record pointing to said webserver. If the client can't resolve subdomain??.example.com, the webserver is irrelevant. | |||
|
feedback
|
|
Another solution I've used in a python website is to inspect the subdomain in a middleware. Then I check that against the database of subdomains and if I find a match I set a request level setting telling the code what subdomain I'm looking at. It's really fairly clean and can work very well. My site currently supports form than 350 dynamic subdomains. | |||
|
feedback
|