Apache Virtual Host on Windows XP
February 3, 2009 – 12:22 amI wanted to set up some virtual hosts in my local environment. I found this very helpful page. Here is the lesson in a nutshell.
Assuming Apache 2.2 is installed in the default location open the following file:
C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
Find the lines that read:
# Virtual hosts #Include conf/extra/httpd-vhosts.conf
and remove the comment (#) so that it looks like this:
# Virtual hosts Include conf/extra/httpd-vhosts.conf
This enables virtual hosting in Apache. Note that it also shuts down the default host.
Open the following Windows file:
c:\WINDOWS\system32\drivers\etc\hostsYou should see something like the following:
127.0.0.1 localhost
Duplicate the line (keep the same IP number) and name a new host, for instance recipemanager and save the file.
Open the following file (this is the file you just enabled in Apache:
C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra\httpd-vhosts.conf
Added the following:
<Directory c:/vhosts> Options Indexes FollowSymLinks AllowOverride All Order Deny,Allow Allow from all </Directory>
This propagates the permissions you set in the directive to cascade to all foldes in c:/vhosts which means you can set up all your virtual servers under c:/vhosts.
Because the default localhost is disabled you need to create that like this:
<VirtualHost *:80> DocumentRoot c:/htdocs ServerName localhost </VirtualHost>
This points localhost at c:/htdocs
Then you can create your recipemanager host:
<VirtualHost *:80> DocumentRoot c:/vhosts/recipemanager/site ServerName recipemanager </VirtualHost>
Reboot Apache. Place a test file in c:/vhosts/recipemanager/site
Navigate with your browser to http://recipemanager/<TESTFILENAME>
And you should see the rendered file.
1 Trackback(s)