You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vincent Bray <no...@gmail.com> on 2007/12/11 04:12:08 UTC

Re: [users@httpd] Named Virtual Hosts on Apache on OS X 10.5 -Apache 2

On 11/12/2007, Bob Hartung <rw...@mchsi.com> wrote:
> Hi all,

Hi,

> 127.0.0.1    main.localhost
> 127.0.0.1    alternate.localhost

That's fine. You can combine them in a single line too, so

127.0.0.1 main.local alt.local

> Original htdocs known as Documents was in /Library/WebServer/
>
> I have added:
>     for "main"  :  /Library/WebServer/main/Documents
>     for "alternate" : /Library/WebServer/alternate/Documents
>
> in /etc/apache2/extra/httpd-vhosts.conf I have this
>
> NameVirtualHost *:80
>
> <VirtualHost *:80>
>    DocumentRoot  "Library/WebServer/main/Documents"
>    ServerName    main.localhost
> </VirtualHost>
>
> <Virtualhost *:80>
>    DocumentRoot "Library/WebServer/alternate/Documents"
>    ServerName  "alternate.localhost"
> </VirtualHost>

Bzzt! You've missed out the leading slash in both DocumentRoots.
Without that the path is appended to ServerRoot, so apache is going to
be looking for /usr/Library/WebServer/...
There's also no need for the quotes unless there's a space in the path
(or hostname, as this applies to both DocumentRoot and ServerName).
See:

http://httpd.apache.org/docs/2.2/configuring.html#syntax

> The line
> "Include /private/etc/apache2/extra/httpd-vhosts.conf" has been uncommented.
>
> In httpd.conf
>    DocumentRoot "/Library/WebServer"
>
>    <Directory "/Library/Webserver">
>        . . . .
>    </Directory>

Although the typical Mac uses a case insensitive filesystem, you'd
still be better off keeping case correct. In this case you have
Webserver rather than WebServer.

> Also I note that there are two httpd.conf files.  One in /etc/httpd and
> the other in /etc/apache2/.  I am not, at this point sure which is used,
> so I have edited them to be identical.

My freshly installed 10.5 has only an empty /etc/httpd, so I would
suggest you just delete the config file in that directory.

-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org