[TriLUG] DocRoot for Name-based Virtual Host

matt-nc ncmail at triad.rr.com
Mon Sep 12 22:59:23 EDT 2005


I'm trying to get a name-based virtual host to point to a directory under a 
user instead of the default directory for localhost.

I created a name-based virtual host in Apache2 by putting the following in 
httpd.conf:

NameVirtualHost *:80

<VirtualHost *:80>
	DocumentRoot /home/amos/dev/php.dev
	ServerName php.dev
</VirtualHost>

then I added the following to the hosts file:

127.0.0.1	php.dev


Now when I put php.dev in the URL window of the browser it points to the 
default document root for localhost which is

/var/www/html

instead of where I want it to point:

/home/amos/dev/php.dev

Is it possible to do what I am trying to do?

Thanks,
Matt





More information about the TriLUG mailing list