| < Previous | Index | Next > |
1) Using Windows Explorer navigate to: C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra.
2) Open the file httpd-vhosts.conf into a text editor (Notepad will work just fine.)
3) You'll see that two Virtual Hosts were created when Apache installed. To save yourself some time delete everything in this file (Select All + Delete) so you are starting from scratch.
4) With the file now empty, add all of the following text:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot C:/www/sandbox.dev/public_html
ServerName sandbox.dev
ServerAlias www.sandbox.dev
ErrorLog C:/www/sandbox.dev/www_logs/error_log.txt
CustomLog C:/www/sandbox.dev/www_logs/access_log.txt common
php_value error_log "C:/www/sandbox.dev/php_error_log.txt"
<Directory "C:/www/sandbox.dev/public_html">
AllowOverride All
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
What we've done here is to tell Apache that a new web site should be created. The DocumentRoot of the site is where all of the web files live (such as your php scripts, html files, css, images, etc). The ServerName and ServerAlias are the names that can be used to access the site via a web browser. The ErrorLog is the path and name of the Apache error file where events such as 404s are recorded. The CustomLog is the path and name of the Apache log file. The php_value error_log tells Apache (and PHP) that PHP errors should be written to the text file php_error_log.txt within thie sites home directory. Finally the Directory block tells Apache to allow over-riding and Indexes, which will let ModRewrite rules and PHP files work.
Why have we used a Virtual Host entry rather than just modify all of the above in the main httpd.conf? The reason is flexibility. Using this approach (as you'll see later on in the guide) we can add lots of different sites to Apache, all of them with their own log files, error reports and domain names, and all of them running off the same local IP address. It also keeps the httpd.conf clean and clutter-free.
5) Save the httpd-vhosts.conf file.
| < Previous | Index | Next > |
|
Need help? Post in the WAMP Guide Forum! © Copyright 2007 - 2008 Richard Davey |