Apache is controlled by a series of configuration files but the one we will be dealing with here is httpd.conf. This file contains instructions on how Apache should run. Several companies offer GUI-based Apache front-ends, but it’s easier to edit the configuration files by hand.
Remember to make back-up copies of all your Apache configuration files, in case one of the changes you make while experimenting renders the Web server inoperable.
Also, remember that configuration changes you make don’t take effect until you restart Apache.
Configure the httpd.conf File:
The httpd.conf file can be found in the conf directory in your Apache installation. In my case, this is the following location:
C:\Program Files\Apache Software Foundation\Apache2.2\conf
1. To include the correct default or index file, you need to find the following code and make sure that your default file name is included (see screenshot).
<IfModule>
DirectoryIndex index.htm index.html
</IfModule>

For ColdFusion and PHP you would also need to include their equivalents, i.e. index.cfm and index.php.
2. Set up a virtual host definition:
<virtualhost>
DocumentRoot c:\WebRoot
ServerName localhost
<directory>
Order allow,deny
Allow from all
</directory>
</virtualhost>
Make sure that the directory permissions are set otherwise a directory forbidden message (such as below) will be displayed.

3. Restart the Apache service. You should then be able to browse to your local website.

4. If you’re doing something cunning like setting up an alias for the local site, e.g. http://whatley.local/ rather than the usual http://localhost/whatley/ then you may need to edit your hosts file e.g.:

In my case, the hosts file is found in the following location: C:\Windows\System32\drivers\etc. You can simply edit this file in notepad, much like with httpd.conf.
And that is all there is to it.
Tags: Apache, configuration, hosts, httpd.conf, local, setup, website




















1 comment
Comments feed for this article
Trackback link
http://www.simonwhatley.co.uk/configuring-your-first-local-apache-website/trackback
22 December 2007 at 6:25 pm
shiva Kumar
sir i did all above but when i execute php file
this itself is displaying no parsing by php is done please hellp me