Sunday, January 11, 2009

Configuring virtual host on windows in Apache 2

I am running two different apps on my localhost. one is in python and other in php.
I also want to learn how to configure virtual host so that 2 different domain names can point to same ip. it turned out to be quite simple. at first it was not working
because I was writing extra slash at end of documentroot, instead of "C:\work\SandipProject1\trunk\Website", I was "C:\work\SandipProject1\trunk\Website\" and getting permission denied.


in your httpd conf,

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot C:\work\SandipProject1
ServerName sandipProject1.com
</VirtualHost>


<VirtualHost *:80>
DocumentRoot C:\work\sandipProject2
ServerName sandipProject2.com
</VirtualHost>

<Directory C:\work\SandipProject1\>
Order Deny,Allow
Allow from all
SetHandler mod_python
PythonHandler index
OPTIONS -Indexes
</Directory>

<Directory C:\work\sandipProject2\>
Order Deny,Allow
Allow from all
DirectoryIndex index.php
</Directory>

No comments: