Virtual Hosts on Apache 2.2.6 [Windows]
What ?
Virtual Hosts allow you to simulate multiple sites on a single server.
i.e, One Server many Websites.
Virtual Hosts is enabled by uncommenting the line :
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf #Uncomment this line
on httpd.conf
The virtual host conf file ./conf/extra/httpd-vhosts.conf
Eg:
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot "F:/webs/localhost"
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "F:/webs/kitiyo.com"
ServerName pp.com
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>
In the above example shows localhost and kitiyo.com host on same server.
Remember to add the sites in the hosts file.
2 comments:
Thanks a lot for a fine read.
Keep up the good work!
Thanks a lot for a fine read.
Keep up the good work!
Post a Comment