12-24-2008, 01:23 PM
I was just wondering how everyone else handles their server when creating a new web site (locally).
I've just been creating a new Virtual hosts and modifying my HOSTS file with every new site. Surely there must be a more efficient way to do this.
12-24-2008, 01:49 PM
If you were managing a live server, you would be using a Hosting Control Panel and the HOSTS file information would be adding entries to an actual name server instead. You might try to find out if any of the opensource/free hosting control panels support using a HOSTS file, otherwise, you probably need to write a script to do this yourself.
12-24-2008, 06:45 PM
I use a PAC file (http://en.wikipedia.org/wiki/Proxy_auto-config)
function FindProxyForURL(url, host)
|| dnsDomainIs(host, '.internal'))
return 'PROXY 127.0.0.1:80; DIRECT';
Any host name without a dot (PlainHostName) or any .internal domain name will be sent to 127.0.0.1:80.
And mod_vhost_alias (http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html)
# Catch all.
# http://example/ to /path/example/
# http://example.com/ to /path/example.com/
# For .internal
# http://example.internal to /different/example/
# A "normal" document root for example.org.
A problem with VirtualDocumentRoots is that it does not change the DOCUMENT_ROOT variable.
12-30-2008, 01:39 PM
Been away on holiday....
But I chose to use dynamic virtual hosts. But I plan on looking at the above suggestions thanks.
12-30-2008, 08:53 PM
But I chose to use dynamic virtual hosts.
That's the same as what i was suggesting (the second part).
The PAC file part is a replacement for editing the HOSTS file each time to add a new "domain".
01-05-2009, 01:53 PM
Sorry, I did notice that after I posted. Thanks for your help for pointing me in the right direction with the PAC file.