// BenQuick.net                           BenQuick.net \\ 

Icon Home
Go back to the front page. There's not much of interest there, though
Icon About this site
Why did I make this site? What do I plan for it? Does any of it matter?
Icon Life
Find out a bit about me. Maybe more than you want to...
Icon DVD's
What DVD's do I own, and what do I think of them?
Icon About you
Find out a little more about yourself. Maybe a little too much!
Icon Cartoon characters
Find out which cartoon character you're most like!
Icon The Apache webserver
Find out how to install and configure the Apache webserver
Icon Password protect your site!
Password protect parts of your website Requires the Apache webserver
Icon Links
Have a gander at other peoples websites

The Apache webserver. What does it do?

Well, it saves a lot of time, and makes me more productive. The Apache webserver... serves webpages. Having it installed on your machine saves a lot of testing time with websites
It saves time, becuse you don't have to upload you latest website, script, or whatever. To find out it doesn't work, then ponder as to why it doesn't work. You have access to the error logs, so you can find out what's going wrong.
How you install Apache depends on what you want from it. This "tutorial" will assume you're all new to the webserver business, and take the standard install

this introduction to Apache is a simple install guide for the Win32 version of Apache

First off - You need to get a copy of the webserver in question download Apache now.
I reccomend getting a pre-compiled release (here). Also called a binary.
When here, select the correct directory for your OS (Windows 95,98,ME,NT,2000 are all win32), then download the newest release.

As of 03/03/01, Apache 1.3.19 is the latest (stable) release for Win32

So, you've just downloaded your Apache binary. Now what do you do with it? Run it, of course!
If you don't know where it is, either

  • Open up Windows Explorer (Start | Run | explorer.exe) and search for "apache_1.3.19-win32-no_src-r2.msi"
Or
  • Start | Search | Files or folders | and search for "apache_1.3.19-win32-no_src-r2.msi"
So, you've now found the installer. Install!


You'll first be presented with a few informational screens. And an agreement, about how the code isn't of top quality at the moment, and such. Then the actual install begins. Please, make sure you've read everything you've been presented with first.

SIDENOTE: There is also a version of Apache to download named apache_1.3.19-win32-src-r2.msi this version includes the sourcecode for Apache, so you can compile your own. As you're reading this tutorial of how to install Apache, I assume you don't want to compile your own

You now have a license agreement to read. Chose to accept or not
License agreement

Once you've decided, click "Next" and read about what Apache (Assuming you agreed) is.


Click next again, and fill in the blanks...



... and click next


Decide what kind of install you want to do. I've chosen "Complete", as it's the best option for most users.
Click next, and decide where to install Apache (I chose e:\all\). Click next, and once more. Close applications that cause the install to halt (This step is due to the 'wonderful' Microsoft installer that Apache are now using). After a number of times of clicking retry (The installer decided there were programs running it missed last time) Apache should install, and you'll be graced with -


Now, you're going to have to do two things
1) Click finish
2) Either bookmark this page, or remember where it is
Step 2 is because due to wonderful Microsoft technologies, you'll have to restart your computer. Hurrah for all things Microsoft

Hopefully you're back from the dead now, and something along the following lines would be good
Config

This brings up httpd.conf for all your editing needs


There is a lot to contend with, but never fear, not all of it is of any use to you at this moment in time

Scroll down until you find

#LoadModule status_module modules/ApacheModuleStatus.so

And change it to read
LoadModule status_module modules/ApacheModuleStatus.so

What's that just done? You've just uncommented (Comments start thie line with '#') a LoadModule directive. Hurrah
Now, when Apache starts, it will start the module "ApacheModuleStatus" - This is an informaional module. More on that later

Just under the changes you made, you'll find

#ExtendedStatus On

Change it to
ExtendedStatus On

Now into the "'Main' server configuration" (The important part)
Make sure you know if you're running another webserver (Internet Information Server (IIS) on Windows NT, Personal Web Server (PWS) on Windows 95\98\ME)
If you are, and if you can, stop that from running. If you can't, don't worry too much

Port 80
Should be the next bit of configuration you need to thinkg about. If you have another webserver running, and can't do anything about it. Then that webserver s running on port 80, so Apache can't. Port 80 is the default http port (Apache's a http server, remember), so webservers always used this port as a standard.
If Apache is your only server running, leave it on port 80, it's easiest this way. If you can't have Apache running on port 80, pick another (Eg 8080)

Once you've decided on a port, you'll be presented with
ServerAdmin you@your.address which you handily decided upon during install. Feel free to change it if it's wrong, though
Change this to suit, but it's not really of any importance, unless you're going to be running a webserver that others will use, whilst unattended
I have...
ServerAdmin test-server@benquick.com
... here. But it doesn't matter what you put.

ServerName test-server.benquick.com
You must now name your server. You can't just invent names, and hope they work, because they won't.
If you have a valid DNS entry for the machine you're running the server on, you can use that. Static IP's are a good thing, in this instance. If you either don't have a DNS entry for your machine, or you don't know what I'm on about.
Make

ServerName something.he.re

Read

ServerName 127.0.0.1

and that will suffice

This should have read wht you entered during install, but you can change your mind about what it reads
Scroll down to
<Directory "e:/all/Apache/htdocs">

#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
    Options Indexes FollowSymLinks MultiViews

#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
    AllowOverride None

#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all
</Directory>


And for ease for reading, and possibly understanding, change it to read

    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all


Now, if you know what .htaccess is, decide what you want to be able to do with it. If you don't, leave everything as it is
If you do know what it is, change the AllowOverride directive to suit

As default, Server Side Includes (SSI) aren't enabled. If you either don't know what they are, or don't want to use them. Leave everything you've just see
Otherwise, change

Options Indexes FollowSymLinks MultiViews

To read

Options Indexes Includes FollowSymLinks MultiViews

Scroll down, until you find

<IfModule mod_dir.c>
    DirectoryIndex index.html
</IfModule>

Now, decide what documents you want to be "defaults"
For instance, your ISP may have told you that on your website, you must have one of the following "index.htm index.html default.htm default.html". This is because, when someone requests your website (E.G. http://www.benquick.com) they don't request the document thwy want to see. Because of this, the webserver has a list of default documents that it looks for if no page is specefied. The above directive tells your server what documents to look for. AND the order to look for them
For instance, one of my servers looks like

DirectoryIndex index.html index.htm index.shtm index.qml index.php index.php3

Which is possibly a bit overkill, but the server in question is used for most things. You may like to have your DirectoryIndex something like

DirectoryIndex index.html index.htm index.shtm index.qml default.htm default.html default.shtm default.qml index.bml index.qml

NOTE: All things *are* case sensitive. Something named index.html is different to Index.html


Search for

    <IfModule mod_negotiation.c>
    LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
    </IfModule>


And change it to

    <IfModule mod_negotiation.c>
    LanguagePriority en
    </IfModule>


Well, change the language to suit

IF you want to be able to exicute CGI scripts from places other than the cgi-bin, chnage

#AddHandler cgi-script .cgi

To AddHandler cgi-script .cgi .pl

This can be a bit of a bad idea, but if you're only running your own server, for testing, it won't do much harm

Back to making SSI work, as described earlyer (Options Includes)
Change the following

#AddType text/html .qml
#AddHandler server-parsed .qml


To

AddType text/html .qml
AddHandler server-parsed .qml


Now, that's essentially the basics of the server set-up, and done. One last thing though. You've enabled a module to be used (ApacheModuleStatus), now lets' make it so it can be used

#<Location /server-status>
#    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from .your_domain.com
#</Location>


First off, un-comment that little lot. Then, decide who can see your server-status page
You may want to have it whereby only you can, that would produce

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Location>


Sorted!
That's the basic configuration of Apache done. Now to run it


Save the changes, goto Start | Programs | Apache http Server | Control Apache Server | Restart
You'll see a DOS box flash up, and dissapear So, Apache's running with your new config. Open your browser (Internet Explorer, Netscape Navigator etc etc) and in the address bar type http://127.0.0.1 or http://localhost/

NOTE: If you're running Apache on a port other than port 80, you'll need to change the address you use to http://127.0.0.1:8080 or http://localhost:8080/ but substitute 8080 for the port Apache's running on

If everything's gone well, you should see something like
Start Screen

And there you go, installing Apache. I will soon write a script, to generate httpd.conf for you, depending on what options you chose. But, until that time, this'll have to do. If you have any questions, please contact me

I have decided to include the following, it's the httpd.conf that I have just generated and used for this tutorial. Feel free to contact me with any questions

I will make available the httpd.conf that I use for using PHP and MySQL at some stage, I hope.

As the following httpd.conf is for use only on this machine, and security isn't a problem, some things have been left wide open. Also, I have cut a few things out, because I know for a fact that it'll never happen (Browser matching, for instance, to force a HTTP/1.0 response. I've cut it, because i'll never ben needed on this server)

Ok, enough talk, more config


- BEGIN -
ServerType standalone
ServerRoot "E:/all/Apache"
PidFile logs/httpd.pid
ScoreBoardFile logs/apache_runtime_status
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MaxRequestsPerChild 0
ThreadsPerChild 50
ClearModuleList
LoadModule info_module modules/mod_info.so
LoadModule status_module modules/mod_status.so
ExtendedStatus On
Port 80
ServerAdmin server@benquick.com
ServerName test-server.benquick.com
DocumentRoot "E:/all/Apache/htdocs"
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory "E:/all/Apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<IfModule mod_dir.c>
    DirectoryIndex index.html
</IfModule>
AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>
UseCanonicalName On
<IfModule mod_mime.c>
    TypesConfig conf/mime.types
</IfModule>
DefaultType text/plain
<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog logs/error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access.log common
ServerSignature On
<IfModule mod_alias.c>
    Alias /icons/ "E:/all/Apache/icons/"
    <Directory "E:/all/Apache/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    ScriptAlias /cgi-bin/ "E:/all/Apache/cgi-bin/"
    <Directory "E:/all/Apache/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>
<IfModule mod_autoindex.c>
    IndexOptions FancyIndexing
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
    AddIconByType (TXT,/icons/text.gif) text/*
    AddIcon /icons/binary.gif .bin .exe
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    AddIcon /icons/layout.gif .html .qml .htm .pdf
    AddIcon /icons/text.gif .txt
    AddIcon /icons/c.gif .c
    AddIcon /icons/p.gif .pl .py
    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^
    DefaultIcon /icons/unknown.gif
    ReadmeName README
    HeaderName HEADER
    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</IfModule>
<IfModule mod_mime.c>
    AddLanguage en .en
    <IfModule mod_negotiation.c>
        LanguagePriority en
    </IfModule>
    AddType application/x-tar .tgz
    AddHandler cgi-script .cgi .pl
    AddType text/html .qml
    AddHandler server-parsed .qml
</IfModule>
<Location /server-status>
    SetHandler server-status
    Order allow,deny
    Allow from all
    Deny from all
</Location>
<Location /cgi-bin/phf*>
    Deny from all
    ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi
</Location>
- END -

Last updated - Thu Oct 4 22:13:53 2007

© 2001, 2002 Ben Quick. Send me E-mail if you have questions or comments. All Rights Reserved <- Does anyone know what that means?!