Hello everyone,
I've a question which I'm sure the experienced among you will know the
answer to immediately.
I'm attempting to develop several sites on my laptop, with the assets
for each in a different folder. I want to make each of these folders a
separate webserver document root, so that I can test each of my sites
independently.
I imagine that virtual hosts are the answer, here.
But I'm having a rather interesting time trying to set up said virtual
hosts. The story so far runs like this:
in my httpd.conf file,
(a) I've enabled name-based virtual hosting with this line:
NameVirtualHost 127.0.0.1:80
- hopefully the loopback IP is OK, here. I am only doing personal
testing after all ... I don't have any requirement to actually webshare
with anyone else, or anything
(b) I also added these vhost descriptions:
<VirtualHost *>
ServerName dev0
DocumentRoot /Users/clive/Documents/Business/webDev/virtualSites/dev0
</VirtualHost>
<VirtualHost dev1>
ServerName dev1
DocumentRoot /Users/clive/Documents/Business/webDev/virtualSites/dev1
</VirtualHost>
(c) I added the corresponding directories dev0 and dev1 at the
locations indicated, and placed a trivial index.html file within each
one:
dev0/index.html displays the message "reached dev0";
dev0/index.html displays the message "reached dev1
-----------------------
So what happens? Well, I have success, partly. If I type "localhost"
into the address bar and hit return, I am rewarded with
reached dev0
This is correct, I think; the first vhost description begins with
<VirtualHost *>, and is meant to be used when no hostname is specified
in the http request, if I understand the Apache docs.
But how do I access the dev1 virtual host? I cannot for the life of me
seem to figure this out. Apparently, there is a "host:" attribute to
supply in the 'header' - whatever that is.
do i specify the host in the URL in some way? If so, then how is this
done? I have tried just about every combination I can think of!
Any advice, or pointers to some online documentation would be warmly
welcomed at this point, ladies and gents
Kind regards,
Clive Green
--
Clive Green