Forum Moderators: phranque
I've tried many different things, so it's hard to say where I am, so I'll lay out my situation and hopefully that helps...
<VirtualHost *>
ServerName www.mytestsite.com
DocumentRoot "/path/to/my/test/site"
</VirtualHost>
Any ideas?
in c:/windows/systems32/drivers/etc/hosts
add a line
127.0.0.1 www.mytestsite.com
Also I repeat the ServerName instead of an *
<VirtualHost www.mytestsite.com>
ServerName www.mytestsite.com DocumentRoot "/path/to/my/test/site"
</VirtualHost>
don't know if that matters, but definately need to change the hosts file.
couple of additional points:
1) changes to httpd.conf only take effect when apache is restarted
2) you might have a problem with your NameVirtualHost directive. In the example file they have
#NameVirtualHost *
just uncommenting it doesn't seem to work but I have
NameVirtualHost localhost
which does work,
I appreciate the help. I've read quite a few tutorials today and they have me doing this and that and some other things, and I really can't say if I've tried all possible combos. I have tried what I thought made sense to me!
Anyway, off to try the NameVirtualHost thing...
Still no glory over here, and I'm wondering if it may be something other than how I set up the 'virtual host' part of the httpd.conf file... If I can set up what works for someone else, just maybe I'd be able to debug the other bits!
Some great advice found on page 4 (30 results per page*4 = 120 results in) in Google.
Check out the error logs and see why apache is failing. So simple.
I would imagine that this is a common procedure, and I can even remember a time in the past when jdMorgan gave me that same advice for another problem.
Time to go play!
fwiw - my problem turned out to be the document root - one of the components in the path had a %20 in place for a space, and that seemed to be what was causing Apache to choke...
Notice that you can set 127.0.0.2 as your second host rather than the default .0.1. you can subsequently add 127.0.0.3 as your the other virtual host.
You can't add a domain name into the server name unless you've got a dns pointed to it & your connected live,so for local testing it's best you use a localhost IP.
The directory/root document has to be the same.
OPtions - are for mod testing, which will apply if u plan to use .htaccess.
You can also name your logs accordingly to the domain specified. It's your choice of agent logs, combined which is best & error logs which is a must to see your wrongs.
Other than that I've also added the cgi-bin script alias so that if you create a cgi-bin folder in that particular site/abc & place perl scripts in it - it will work.
Hope that helps.
That's as far as I've gone.
I'll have a closer look at that after some sleep!
In the meantime, here's what I've got set:
NameVirtualHost *<VirtualHost 127.0.0.2>
ServerName www.testsite.com
DocumentRoot "D:/path/to/my/web/site/"
</VirtualHost>
I have set my HOSTS file accordingly.
Also, .htaccess is working as I have 'options' etc. set elsewhere in the .conf file...