HomeApache Page 3 - Installing and Configuring Apache 2 on a Windows XP Machine
Configuring - Apache
Apache 2 represents quite a change from previous versions. If you have set up a previous version of Apache on a Windows XP PC, you will be interested in setting up the new version. Dan Wellman shows how to set up and configure Apache 2 on a Windows XP PC to give you a development environment that will allow you to test your PHP and other dynamic web technologies before taking them live.
To make creating a test website easier, you should reconfigure the DocumentRoot to a more accessible folder than the default of C:/Program Files/Apache Group/Apache2/htdocs. Create a folder on your C drive and call it mysite or something similar. Within this folder, you can create a sub-folder called documents or something similar. Web site roots are normally set up so the the HTML files are kept in one folder, the JavaScript files in another, and so on. Stick an HTML file in the folder, just something basic that renders a sentence in the browser.
Now go to the Start menu and select Edit the Apache httpd.conf Configuration File from the Apache program group. This will open the main configuration file used by Apache. You’ll need to scroll down to section two and find a directive called DocumentRoot. Change the value to C:/folderyoujustcreated. A little bit further down, you’ll see a <directory “C:/Program Files/Apache Group/Apache2/htdocs”> directive which will also need to be changed to whatever the DocumentRoot was set to.
Now save the file, restart the server and open a browser window. Type http://localhost in the address bar again and the HTML file you just created should be displayed. If instead, you see a directory style listing with Index of / at the top of the page, it means that you saved the HTML file with a HTM extension. To correct this, open the httpd.conf file again and scroll down past the changes you just made to the DirectoryIndex directive. Add index.htm to the end of the line and again save the file and restart the server. Refresh the page and you will see the proper document.