[TriLUG] DocRoot for Name-based Virtual Host

Rick DeNatale rick.denatale at gmail.com
Wed Sep 14 10:18:47 EDT 2005


On 9/14/05, Josh Vickery <vickeryj at gmail.com> wrote:
> Your config snippets look ok to me.  I would check to make sure there
> is not another virtual host directive that is overriding this
> somewhere else.  NameVirtualHost *
> <VirtualHost *>
> ...
> for example.
> 
> On 9/12/05, matt-nc <ncmail at triad.rr.com> wrote:
> > 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

It might be a good idea to check the log files and/or manually start
Apache and see if it complains about the config on startup.  For SOME
cases where you've set up the config in a way that it won't resolve
vhosts the way you might expect, it will tell you, perhaps
cryptically.



More information about the TriLUG mailing list