- Locate and edit 'httpd.conf' file (should be in 'C:\Apache2\Apache2\conf\httpd.conf')
--------------
ServerRoot, ServerName, DocumentRoot etc will all have been pre-set according to what information you provided in the intial installation phase. Check these and it is ok to change them manually if your setup needs or locations change.
Locate this code near the bottom of the file :-
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>
and just below it add a new directory container for your base websites files locations.
<Directory "d:/accounts/*/">
AllowOverride None
AddType text/html .shtml
AddHandler server-parsed .shtml
Options FollowSymLinks +Includes
Order allow,deny
Allow from all
AddOutputFilter INCLUDES;DEFLATE shtml
</Directory>
In the above example, this is needed to configure the directory structure for where our virtual hosts will be placed on the server - and this for security reasons is outside of the directory structure for the web server apache files themselves. Here I have created a directory called 'accounts' where all websites will be based beneath.
Find the code section:-
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
and make it look like this :-
<IfModule dir_module>
DirectoryIndex index.html index.shtml index.php
</IfModule>
Find the section :-
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
and uncomment out those last two lines to read :-
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
--------------
There is now a supplementary section near the bottom of httpd.conf which gives you the option to include extra configuration files into your setup. In our case, the virtualHosts that we want to configure, instead of doing so at the bottom of this httpd.conf file, we instead enable the 'httpd-vhosts.conf' file and do our configurations in there.
Still in httpd.conf file , find the section which is headed by :-
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
and then find these two lines of code :-
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
Uncomment out the second line to enable the external vhosts file :-
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Ok, we are done with httpd.conf file but we are not done configuring. We now need to edit /extra/httpd-vhosts.conf and configure our virtual host containers. Save and Close 'httpd.conf' file.
- Locate and edit 'httpd-vhosts.conf' file (should be in '..\conf\extra\httpd-vhosts.conf')
NameVirtualHost *:80 should already be enabled - that is uncommented, if not enable it.
then create a new VirtualHost container for your first site (yoursite.com).
<VirtualHost *>
ServerName yoursite.com
ServerAdmin webmaster@yoursite.com
DocumentRoot "D:/accounts/yoursite"
ServerAlias www.yoursite.com yoursite.dnsalias.com
ErrorLog logs/yoursite.com-error_log
CustomLog logs/yoursite.com-access)log combined
AddHandler server-parsed .shtml
Options FollowSymLinks +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</VirtualHost>
The first VirtualHost container block - or the only container block - is also the fallback default virtualhost should any other requests not be found. More information on configuring VirtualHost containers is at http://httpd.apache.org/docs/2.2/vhosts/
Ok so that about it, Save the file, then 'Stop' and 'Start' the Server again.
Check that the default site is now our new VirtualHost by going to http://localhost
in your browser. Of course you will already have some files including an index
page in d:/accounts/yoursite/ or you'll get a 404 error.
Back to Start the Main Installation | Forward
to Extra Configurations ![]()

