Archive for September, 2011

Dynamically manage Apache virtualhosts in Linux

This is second part of article to describe how to dynamically manage Apache Virtual host. You can read first article here.

In earlier article I mentioned using a php script to dynamically create/remove virtualhost entry in Apache (httpd) config file and then reload it using cron.

Here I would describe how to manage DNS to dynamically recognize newly created virtualhosts. Again, this might not be the best or efficient way to implement this but this is what worked for me. After creating virtualhosts in Apache, you need to update DNS so that new virtualhosts start working. To update DNS dynamically, your DNS provider should have some way (like API) which enable you to manipulate its records. There are few providers offering this facility. For this experiment, I selected DNSMadeEasy which provides APIs to add/remove/update records on fly using scripts.

PHP script to dynamically create/remove apache virtual hosts/ subdomains

There’s situation with my friend where his team wanted to dynamically create/remove virtual hosts or subdomains using php. This can be achieved in several ways. You can use a control panel which obviously use resources or develop your own script to do this. There’s security aspects attached with script because it needs to update file which is read by Apache and to apply settings, you need to reload Apache. Here I am describing how my friend achieved their goal, again I’m saying that this might not be the best way to do this thing and may be comparatively insecure or inefficient but this is what worked for them in Ubuntu host.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes