minitutorials main logo the place to learn online

Sponsor This Site!
Sponsorship Details - miniTutorials is taking enquiries into various Sponsorship opportunities. Available NOW! Read More on our Sponsorship page.
This Page Sponsored by :
Proudly Sponsored by Your Company name here!
miniTutorials Sponsorship
Donate!
Consider donating to keep this site alive and up to date. Click on the Donate button to go straight to PayPal site and make a donation of an amount you choose.


More information on where the money goes on the Donations page.
Discussion Forums
visit the mini tutorial forums
For expert help and advice on any of our Tutorials or anything else .... visit the forums and ask away!!
Google Ads
My Profile

Details about the owner of this site can be found at :-

ohloh profile
View Gavin McDonald's profile on LinkedIn
Powered by a
UK2 Dedicated Server

Apache Web Server.

Apache 2.2.2 Installation Instructions.

Intermediate Level

Installing Apache


Step 3 : Lets Configure our new Server.

These instructions configure the Server for SSI as well as taking the 'VirtualHosts' approach. This enables you to then add more web sites as needed just by configuring a new 'VirtualHost' for each. PHP config options will be added in the PHP tutorial section. Below instructions assume 'yoursite.com' as the site name, change to suit yours!!

--------------

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.

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.

left arrow depicting to go back Back to Start the Main Installation | Forward to Extra Configurations right arrow depicting to go forward


irca content rating labelValid CSSValid XHTML 1.0 Strict[Valid RSS] About Us | Site Map | Privacy Policy | Contact Us | ©2003 - 2008 miniTutorials.com link to minitutorials xml feedLink to RSS Feed

Site Design by 16 degrees complete web solutions.