Step-by-Step: Apache 2.0.35 - Changing the Document Directory
April 28, 2002

Here we'll cover some basics on configuring Apache.  Apache is configured by a very large file called "httpd.conf".  In this file are the instructions for how Apache behaves.  Much of the file are comments which are not processed by the server.  All lines with comments start with the pound symbol "#".  The lines that actually take effect do not have the pound symbol at the beginning.  The comments give you a good idea of what each line in the configuration file does.  It may be a good idea to just print out the whole "httpd.conf" file and study it and all the different parts.

Take a look at your "Start" menu.  Apache is now setup there.

First let's cover where you'll put your documents so that people can see them from the Internet.  To do this we'll look in the "httpd.conf Configuration file".  Go to "Start" --> "Programs" --> "Apache HTTP Server 2.0.35" --> "Configure Apache Server" --> "Edit the httpd.conf Configuration file".

A text file called "httpd.conf" pops up.

Use the "Find" function of notepad to search for "DocumentRoot".  You'll see this.

By default, all web documents will be stored in "C:/Program Files/Apache Group/Apache2/htdocs".   Let's test this out by creating a small file called "index.html" with the message "hello cruel world!" and putting it into this directory.  The reason we called it "index.html" is because that's the default document type for Apache.  When Apache finds a "index.html" file in a directory, it know to display this file first.  Go to your web browser again and type in either "http://localhost" or "http://127.0.0.1".  You should see our message.

Now, you can either keep this directory for all your web files, but personally I would change it to something in a less buried directory like "C:\webdocs" or something like that.  It's up to you.  All you have to do is change the path in the config file.  To illustrate, take a look at the picture where I changed the Document Root to "C:\webdocs".  Easy.

When you close the window with the configuration file with your changes, you'll see this message asking if you want to save your changes.  Click "Yes".

However, although you saved your changes, your changes are not in effect since the webserver is already running.  You must restart the Apache webserver for your changes in your "httpd.conf" file to take place.  You can do this easily by selecting "Restart" in the Apache program group.

Now that we've restarted our Apache server, let's see what happens when we go to "http://localhost".

Wow, what a large message.  Well, we get this message because we haven't created "c:\webdocs" nor created a default file.  Once I create the proper directory and default file, we get this.  That's much better (I think)

Next: Changing the port number



Installing Apache for Windows

Additional Information

Apache Info: