Setting up Apache HTTP Server

For Windows, Apache version 1.3.24
By Craig

  1. Download the Apache binary setup file and install.

  2. All configuration is done in the file /conf/httpd.conf. Open this in Notepad or some other plain text editor. This file looks confusing at first, but there are only a few things to change. To make things easier, I have created a template for you to use.

  3. Find the first set of ####### in the template. This is the option for setting the amount of connections that are allowed at once.

    ThreadsPerChild 30
  4. Keep in mind that one person may use several connections at once (either by downloading different files at once or using a download accelerator). A good way to decide on this number is to take your total bandwidth and divide by the minimum amount you want a person to have. For example, I have a total of 1,250KB/s upstream, and I want everyone to get at least 40KB/s. 1,250/40 is approxiamately 30. Make sure to keep your units straight (8kb = 1KB).

  5. Scroll to the next set of #######. Put in your e-mail address. This will be linked to on the main page, and it doesn't matter if the e-mail address is correct (ie, you can put in "address-at-domain-dot-com"). Down just a little further is where you name your server (same exactness rules apply).

    ServerAdmin address@domain.com

    ServerName 123.45.67.89

    or

    ServerName www.domain.com
  6. Find the next section of #######. This is where you define which directories will be accessible to outside users. To add new directories, create a new <Directory> </Directory> section. You may add as many as you wish.

    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>

    <Directory "C:/Program Files/Apache/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    Leave the above part intact. Use the following examples to guide you.

    <Directory "D:/SHN">
    Options FollowSymLinks Indexes Multiviews
    IndexOptions FancyIndexing
    </Directory>

    In this section, D:/SHN is the directory on my drive that I want to share. All subdirectories (ie, D:/SHN/dmb and D:/SHN/phish) are automatically shared. To add more folders, copy and paste that entire <Directory> block and change the D:/SHN to what you want. Be sure to use forward slashes, but no trailing slash.

    If you want the user to see an HTML file when they browse to that directory, you can include an index.html file, otherwise Apache will automatically generate a list of the directory's contents. You can play around with the other settings in each block to determine what contents are listed. It can be set to allow only certain types of files to be seen or downloaded, or allow/deny access to a specific user. The settings I have will allow all files to be seen and downloaded (but not changed or deleted). More info at Apache.org.

  7. Scroll down a bit further to find the next set of #######. This is where we set our aliases. An alias is a folder name that outside users see; it is used to disguise the layout of the folders on your drive as well as make it easier to organize your files. Let's look at the example:

    Alias /icons/ "C:/Program Files/Apache/icons/"
    Alias /temp/ "D:/temp/"
    Alias /shn/ "D:/SHN/"

    Leave the icons alias there, and focus on the rest. According to this example, when someone browses or clicks to http://www.domain.com/shn/ it will list the contents in my D:/SHN folder. Be sure to include the trailing slash (and make sure they're forward slashes). Keep in mind that these are case sensitive; if someone types in http://www.domain.com/sHN/ it will not work. If you're concerned about case-sensitivity, you might want to do something like this:

    Alias /shn/ "D:/SHN/"
    Alias /SHN/ "D:/SHN/"

    so that either way, the user will find what they're looking for. You need only make one alias per directory, you don't need one for each subdirectory. Also, a directory will not be accessible by an outside user unless you make an alias for it.

  8. You're done with the conf file. Now you'll need to create an index.html file, which will be the first thing your visitors will see whenthey come to your site. This file can have links to other html files or to your folders (using the appropriate alias!). Put this file in the /htdocs/ folder, replacing the one that is there now.

That's it! So why does Apache have to be so complicated? It's a very powerful and sophisticated program. It is, however, the best http server (it's used by 54% of all websites you visit, including many big-name sites). It takes up very little memory considering how much it handles, it's very fast, it's stable, and its possibilities are endless. Best of all, it's free and continuously being updated.

Return to Guides

Other Links