In previous version of Apache one httpd.conf file was maintained for all setting of the Apache webserver, including Virtual hosts. In later version, this apprach has been changed. It has been made more modular so that httpd.conf file contains a link to Include “conf/extra/httpd-vhosts.conf”.
The virtual host file contains all virtual hosts. By default no virtual hosts are provided. Templates are available though which can be modifed according to the needs. Some tweak of windows host file is needed as well.
Using this appraoch, you can host a website anywhere on the hard disk, not necessarily only in htdocs folder
1. Start with Window host file. Copy
in Window explorer. This file does not has an extension. It will ask you a choice which program to use. Select notepad.
2. Edit the file. Add this entry
127.0.0.1 mytestsite <----- I have added this entry
3. No Go to virtual host files maintained by Apached. They are located in this file
Almost all of this file is commented, make sure you added this two entries in this file. Are you can ucomment the existing one and modify it to these (more desirable)
NameVirtualHost *:88 # put this in the beginning of the file
# put this anywhere below the line above
CustomLog "logs/dummy-host.localhost-access.log" combined
Notice that my test sites is sitting in C:\MyWebsites\Justablog\ folder. Use forward slashes instead of backwards.
4. Create this folder and put a test php file in it such as this. Name it index.php
I am alive
5. The virtual hosts are not by default linked in the httpd.conf file. Edit the httpd.conf file and search for this string
If you can’t find it. Search for a smaller part of the above string. If you find it and there is no # symbol ahead of it, leave it as it is. Otherwise remove the # sign.
5. If you restart your apache server at this point and access the site, you will be given access denied error. To fix that you have to add the permission in httpd.conf file (the one you have already opened). Add this somewhere
<directory "c:="" mywebsites="" justablog"="">
Options Indexes FollowSymLinks Includes ExecCGI
Allow from all
<directory "c:="" xampp="" htdocs"="">
At this point you should be all set.
Make sure all directories that are entered in config file are case sensitive, otherwise it will not work.