Skip to main content
Inspiring
June 1, 2006
Question

Virtual hosts in Apache

  • June 1, 2006
  • 9 replies
  • 532 views
I have followed the 'Powers doctrine' in defining virtual hosts for my
Apache installation. This is the relevant section in the httpd.conf file

<VirtualHost *:80>
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/wild"
ServerName wild
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/practical"
ServerName practical
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/navenewell"
ServerName nni
</VirtualHost>

Yet none of them seem to work. When I browse to http://wild, for example, I
get a not found error. I still need to use http://localhost/wild to get
there. What's that about?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



This topic has been closed for replies.

9 replies

Inspiring
June 4, 2006
Thank you, Richard. That's exactly it....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Richard Mason" <whitneyrm@xtra.co.nz> wrote in message
news:IO2lD+Ie1igEFwqo@xtra.co.nz...
> On Thu, 1 Jun 2006, Murray *ACE* wrote
>
>>The documentation mentions a command line I can use with Apache to check
>>the virtual server configuration, but it's *nix, referring to
>>/usr/local/apache2/bin/httpd -S. This would be handy, but I do not see an
>>httpd file or folder within the Apache2/bin folder on my XPHome system.
>>Any ideas?
>
> If it's of any use - In the command box change to the bin folder
> containing Apache.exe and then:
> Apache -S
> --
> Richard Mason


Inspiring
June 4, 2006
On Thu, 1 Jun 2006, Murray *ACE* wrote

>The documentation mentions a command line I can use with Apache to
>check the virtual server configuration, but it's *nix, referring to
>/usr/local/apache2/bin/httpd -S. This would be handy, but I do not see
>an httpd file or folder within the Apache2/bin folder on my XPHome
>system. Any ideas?

If it's of any use - In the command box change to the bin folder
containing Apache.exe and then:
Apache -S
--
Richard Mason
Inspiring
June 4, 2006
On Thu, 1 Jun 2006, Dave Buchholz wrote

> I use apache 1.3 and this is how my http.conf file looks:
>
>
><VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs"
> ServerName localhost
></VirtualHost>

I've just installed Apache 2.0.58 and the manual says:
"The directives that accept filenames as arguments must use Windows
filenames instead of Unix ones. However, because Apache uses Unix-style
names internally, you must use forward slashes, not backslashes".

Very confusing.
--
Richard Mason
Inspiring
June 1, 2006
no problem glad I could return the help you have given me in the past

--
Dave Buchholz
I-CRE8
www.i-cre8.co.uk


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:e5mrb8$9jj$1@forums.macromedia.com...
Hmm - good idea.... I believe that cracked it.

Thanks, Dave!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Dave Buchholz" <dave.buchholz@REMOVETHISdsl.pipex.com> wrote in message
news:e5mqr4$90v$1@forums.macromedia.com...
> have you added the entries to the windows hosts file ?
>
> --
> Dave Buchholz
> I-CRE8
> www.i-cre8.co.uk
>
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:e5mqao$8ae$1@forums.macromedia.com...
> Dave:
>
> I have now added that line to httpd.conf, and restarted Apache, but it's
> still not working as I would expect it to.
>
> The documentation mentions a command line I can use with Apache to check
> the
> virtual server configuration, but it's *nix, referring to
> /usr/local/apache2/bin/httpd -S. This would be handy, but I do not see an
> httpd file or folder within the Apache2/bin folder on my XPHome system.
> Any
> ideas?
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "Dave Buchholz" <dave.buchholz@REMOVETHISdsl.pipex.com> wrote in message
> news:e5mmmm$3rq$1@forums.macromedia.com...
>> Murray,
>>
>> you don't appear to have actually defined the localhost folder, I use
>> apache
>> 1.3 and this is how my http.conf file looks:
>>
>> NameVirtualHost 127.0.0.1
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs"
>> ServerName localhost
>> </VirtualHost>
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\i-cre8"
>> ServerName i-cre8.local
>> </VirtualHost>
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache
>> Group\Apache\htdocs\standardsitephp
>> ServerName standardsitephp.local
>> </VirtualHost>
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\xhtmlsitephp
>> ServerName xhtmlsitephp.local
>> </VirtualHost>
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\cricketclub
>> ServerName cricketclub.local
>> </VirtualHost>
>>
>> I use the suffix .local on all my localhost sites to indentify them. I
>> used
>> this tutorial http://apptools.com/phptools/virtualhost.php as the basis
>> for
>> my set-up if that helps.
>>
>> --
>> Dave Buchholz
>> I-CRE8
>> www.i-cre8.co.uk
>>
>>
>
>
>



Inspiring
June 1, 2006
Hmm - good idea.... I believe that cracked it.

Thanks, Dave!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Dave Buchholz" <dave.buchholz@REMOVETHISdsl.pipex.com> wrote in message
news:e5mqr4$90v$1@forums.macromedia.com...
> have you added the entries to the windows hosts file ?
>
> --
> Dave Buchholz
> I-CRE8
> www.i-cre8.co.uk
>
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:e5mqao$8ae$1@forums.macromedia.com...
> Dave:
>
> I have now added that line to httpd.conf, and restarted Apache, but it's
> still not working as I would expect it to.
>
> The documentation mentions a command line I can use with Apache to check
> the
> virtual server configuration, but it's *nix, referring to
> /usr/local/apache2/bin/httpd -S. This would be handy, but I do not see an
> httpd file or folder within the Apache2/bin folder on my XPHome system.
> Any
> ideas?
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "Dave Buchholz" <dave.buchholz@REMOVETHISdsl.pipex.com> wrote in message
> news:e5mmmm$3rq$1@forums.macromedia.com...
>> Murray,
>>
>> you don't appear to have actually defined the localhost folder, I use
>> apache
>> 1.3 and this is how my http.conf file looks:
>>
>> NameVirtualHost 127.0.0.1
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs"
>> ServerName localhost
>> </VirtualHost>
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\i-cre8"
>> ServerName i-cre8.local
>> </VirtualHost>
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache
>> Group\Apache\htdocs\standardsitephp
>> ServerName standardsitephp.local
>> </VirtualHost>
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\xhtmlsitephp
>> ServerName xhtmlsitephp.local
>> </VirtualHost>
>>
>> <VirtualHost 127.0.0.1>
>> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\cricketclub
>> ServerName cricketclub.local
>> </VirtualHost>
>>
>> I use the suffix .local on all my localhost sites to indentify them. I
>> used
>> this tutorial http://apptools.com/phptools/virtualhost.php as the basis
>> for
>> my set-up if that helps.
>>
>> --
>> Dave Buchholz
>> I-CRE8
>> www.i-cre8.co.uk
>>
>>
>
>
>


Inspiring
June 1, 2006
have you added the entries to the windows hosts file ?

--
Dave Buchholz
I-CRE8
www.i-cre8.co.uk


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:e5mqao$8ae$1@forums.macromedia.com...
Dave:

I have now added that line to httpd.conf, and restarted Apache, but it's
still not working as I would expect it to.

The documentation mentions a command line I can use with Apache to check the
virtual server configuration, but it's *nix, referring to
/usr/local/apache2/bin/httpd -S. This would be handy, but I do not see an
httpd file or folder within the Apache2/bin folder on my XPHome system. Any
ideas?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Dave Buchholz" <dave.buchholz@REMOVETHISdsl.pipex.com> wrote in message
news:e5mmmm$3rq$1@forums.macromedia.com...
> Murray,
>
> you don't appear to have actually defined the localhost folder, I use
> apache
> 1.3 and this is how my http.conf file looks:
>
> NameVirtualHost 127.0.0.1
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs"
> ServerName localhost
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\i-cre8"
> ServerName i-cre8.local
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache
> Group\Apache\htdocs\standardsitephp
> ServerName standardsitephp.local
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\xhtmlsitephp
> ServerName xhtmlsitephp.local
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\cricketclub
> ServerName cricketclub.local
> </VirtualHost>
>
> I use the suffix .local on all my localhost sites to indentify them. I
> used
> this tutorial http://apptools.com/phptools/virtualhost.php as the basis
> for
> my set-up if that helps.
>
> --
> Dave Buchholz
> I-CRE8
> www.i-cre8.co.uk
>
>



Inspiring
June 1, 2006
Dave:

I have now added that line to httpd.conf, and restarted Apache, but it's
still not working as I would expect it to.

The documentation mentions a command line I can use with Apache to check the
virtual server configuration, but it's *nix, referring to
/usr/local/apache2/bin/httpd -S. This would be handy, but I do not see an
httpd file or folder within the Apache2/bin folder on my XPHome system. Any
ideas?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Dave Buchholz" <dave.buchholz@REMOVETHISdsl.pipex.com> wrote in message
news:e5mmmm$3rq$1@forums.macromedia.com...
> Murray,
>
> you don't appear to have actually defined the localhost folder, I use
> apache
> 1.3 and this is how my http.conf file looks:
>
> NameVirtualHost 127.0.0.1
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs"
> ServerName localhost
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\i-cre8"
> ServerName i-cre8.local
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache
> Group\Apache\htdocs\standardsitephp
> ServerName standardsitephp.local
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\xhtmlsitephp
> ServerName xhtmlsitephp.local
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\cricketclub
> ServerName cricketclub.local
> </VirtualHost>
>
> I use the suffix .local on all my localhost sites to indentify them. I
> used
> this tutorial http://apptools.com/phptools/virtualhost.php as the basis
> for
> my set-up if that helps.
>
> --
> Dave Buchholz
> I-CRE8
> www.i-cre8.co.uk
>
>


Inspiring
June 1, 2006
Murray,

you don't appear to have actually defined the localhost folder, I use apache
1.3 and this is how my http.conf file looks:

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\i-cre8"
ServerName i-cre8.local
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\standardsitephp
ServerName standardsitephp.local
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\xhtmlsitephp
ServerName xhtmlsitephp.local
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "C:\Program Files\Apache Group\Apache\htdocs\cricketclub
ServerName cricketclub.local
</VirtualHost>

I use the suffix .local on all my localhost sites to indentify them. I used
this tutorial http://apptools.com/phptools/virtualhost.php as the basis for
my set-up if that helps.

--
Dave Buchholz
I-CRE8
www.i-cre8.co.uk


Inspiring
June 1, 2006
On 01 Jun 2006 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:

> I have followed the 'Powers doctrine' in defining virtual hosts for
> my Apache installation. This is the relevant section in the
> httpd.conf file
>
> <VirtualHost *:80>
> DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/wild"
> ServerName wild
> </VirtualHost>
> <VirtualHost *:80>
> DocumentRoot "C:/Program Files/Apache
> Group/Apache2/htdocs/practical" ServerName practical
> </VirtualHost>
> <VirtualHost *:80>
> DocumentRoot "C:/Program Files/Apache
> Group/Apache2/htdocs/navenewell" ServerName nni
> </VirtualHost>
>
> Yet none of them seem to work. When I browse to http://wild, for
> example, I get a not found error. I still need to use
> http://localhost/wild to get there. What's that about?

The only thing I can see is that maybe the directives need to be in
ServerName/DocumentRoot order? Doesn't make sense to me, because
Apache usualy isn't that fussy. I have Apache on a Linux box; using
this:

<VirtualHost *:80>
ServerName slcha.tld
DocumentRoot /home/slcha/public_html
</VirtualHost>

it works just fine browsing to http://slcha.tld/ from my windows box.
(Windows "hosts" file has an entry mapping slcha.tld to the IP for the
server.)

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php