Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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>
ServerName www.my-goods-distributor.co.uk 
ServerAlias my-goods-distributor.co.uk
DocumentRoot /www/my-goods-distributor.co.uk
ScriptAlias /cgi-bin/ /www/my-goods-distributor.co.uk/bin
</VirtualHost>

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

1 Answer 1

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.

http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html

share|improve this answer

Your Answer

 
discard

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.