Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got Apache 2.28, on Web-Developer Server Suite, PHP 5.38, MySQL latest version, and have got about 5 virtualhosts.

This is my latest virtual host, which was a dynamic one:

UseCanonicalName Off
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/
ScriptAlias /cgi-bin/ /www/

I added it to hosts and it took me to localhost's page instead. Normally after adding virtual hosts I use cmd, and type in httpd -k restart (graceful restart) which does it, but I want to try and automate this process a bit.

I did try what was in the documentation, but I'm new to this.

How should/can I get Apache to add virtualhosts without restarting the server by hand, like webhosting companies do, even though I'm using Windows and a hosts file? I don't think the major webhost companies turn the servers on and off by hand, and my server, although it's a testing one, is intended to replicate some functions of PHP/MySQL before any sites go live on other webhosts.

Any advice is appreciated, thanks!

share|improve this question
I have automated scripts that handle issuing graceful restarts (or reloads in the case of adding SSL sites). If you look at something like CPANEL, which lots of hosting companies use, you will see it indeed does a graceful when adding/deleting sites. – Doon Sep 13 '11 at 18:52
up vote 2 down vote accepted

Apache's mod_vhost_alias is what I'd imagine many shops use. There are also some ldap or sql-backed vhost modules, but my google-fu is failing me at the moment.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.