• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

apache 2.0 virtualhost problem

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Fightingpiper

Member
Joined
Oct 29, 2001
Location
St. Paul, MN
When I set up a virtual host with apache it then uses that directory as the document root directory for the server. How can I get it to not do this? I want to keep the document root directory at C:\FoxServ\www

I have a website of mofrogs in the WWW directory that I want to set up using virtual hosts.

here is the way I have tried it but it hijacks the documentroot directory so when I use localhost in the browser it goes to the mofrogs site but I want it to stay in the C:/foxserv/www and have that be my localhost directory not mofrogs.com. Hope I made sense....

<VirtualHost *>
# ServerAdmin [email protected]
ServerName www.mofrogs.com
DocumentRoot C:\FoxServ\www\mofrogs
#
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>
 
make a new virtual host using the following:
Code:
<VirtualHost _default_:80>
Servername localhost
DocumentRoot c:\FoxServ\www\
</VirtualHost>

If the above doesn't work, replace localhost with your machine's ip address. You might have to make multiple ones to cover both internal and external addreses. And if it doesn't like _default_ try just using * as you have it above.
 
Don't forget the command:
Code:
NameVirtualHost *:80
Need that somewhere in your config outside of the <VirtualHost> directives(tells apache that you are running Name Virtual Hosts, on the stated IP (all) and port (80)
 
Back