-
July 2nd, 2002, 06:31 PM
#1
Configuring Apache
Apache configuration by Jethro
------------------------------
Index:
o Introduction
o httpd.conf
o Final Notes
o Conclusions
Introduction
------------
The Apache http server is widely-acclaimed as being the best and most
secure http server around. There are more Apache http servers around
now, than all the other http servers (such as Microsoft's IIS)
combined.
The best part is: it's free! Well maybe that's not the best part, but
it's a pretty damn good plus factor.
Apache is very easy to install and configure as I'm going to show you.
I have Apache running on both Windows ME and Red Hat Linux 6.1. I use
the Windows ME Apache http server simply for testing out any PHP or
CGI applications I write. Hosting a website on Windows ME is a bad
idea, so if I need to host anything, I put it on the Red Hat Apache
installation. For security reasons, so no-one steals my precious,
precious files.
As this is a configuration guide and not an installation guide, I will
cut straight to the httpd.conf file. In the newer versions of Apache,
it is advised to just put everything in conf/httpd.conf files and
leave the other conf files (access, srm...etc) blank.
I wrote a tutorial on .htaccess files (you can find it on the
TechnoRats website, or on AntiOnline), so if you find something not
explained, it's because it's explained there.
The following is the httpd.conf from my Windows ME Apache installation.
Most of the .conf file itself already in your /conf directory is
pretty self-explanatory and self-documenting, but I might be able to
shed some light on it, if the current definitions in your httpd.conf
file are a little terse. (Note: most existant comments have been
removed, because this text would be unneccesarily long otherwise.
Also, directives which have been commented out because they are either
non-applicable to this installation type, or they aren't used anymore,
have also been removed. Lastly, some Apache definitions are used,
because they do the job)
http.conf
---------
ServerType standalone
# This means the server is a standalone server. The alternative is ``inetd``
# but that is only if you have to network a load of servers together.
ServerRoot "C:/Program Files/Apache Group/Apache"
# This is where Apache is located
# Note: This is the default installation path
PidFile logs/httpd.pid
# Pid stands for Process IDentification number and is assigned to the Apache
# session each time it is started
Timeout 300
# Basically, the number of seconds to wait for receives and sends before
# ``timing out``.
KeepAlive On
# This is whether you want to allow more than one request per session. Remember
# to keep this *On* always.
MaxKeepAliveRequests 100
# Maximum number of requests during a connection. Apache advises to keep this
# number high. 0 means no limit
KeepAliveTimeout 15
# This how many seconds to wait for a directive from a visitor to your site.
MaxRequestsPerChild 0
# MaxRequestsPerChild: the number of requests each child process is
# allowed to process before the child dies. All you *need* know if
# you are running Windows, is just keep this at 0.
ThreadsPerChild 50
# Number of concurrent threads (i.e., requests) the server will allow.
# Set this value according to the responsiveness of the server (more
# requests active at once means they're all handled more slowly) and
# the amount of system resources you'll allow the server to consume.
Listen 3000
Listen 12.34.56.78:80
# I don't actually use this, but I wanted to add it anyway. It tells
# Apache to listen to the following ports and IPs. Optional.
#
# Reconstruction of the complete module list from all available modules
# (static and shared ones) to achieve correct module execution order.
#
# The modules listed below, without a corresponding LoadModule directive,
# are static bound into the standard Apache binary distribution for Windows.
#
# Note: The order in which modules are loaded is important. Don't change
# the order below without expert advice.
#
# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE, UPDATE THIS TOO!]
ClearModuleList
#AddModule mod_vhost_alias.c
AddModule mod_env.c
AddModule mod_log_config.c
#AddModule mod_mime_magic.c
AddModule mod_mime.c
AddModule mod_negotiation.c
#AddModule mod_status.c
#AddModule mod_info.c
AddModule mod_include.c
AddModule mod_autoindex.c
AddModule mod_dir.c
AddModule mod_isapi.c
AddModule mod_cgi.c
AddModule mod_asis.c
AddModule mod_imap.c
AddModule mod_actions.c
#AddModule mod_speling.c
AddModule mod_userdir.c
AddModule mod_alias.c
#AddModule mod_rewrite.c
AddModule mod_access.c
AddModule mod_auth.c
#AddModule mod_auth_anon.c
#AddModule mod_auth_dbm.c
#AddModule mod_auth_digest.c
#AddModule mod_digest.c
#AddModule mod_proxy.c
#AddModule mod_cern_meta.c
#AddModule mod_expires.c
#AddModule mod_headers.c
#AddModule mod_usertrack.c
#AddModule mod_unique_id.c
AddModule mod_so.c
AddModule mod_setenvif.c
Port 80
# Of course, the port Apache listens. Leave this at 80.
ServerAdmin jethrojones@gmx.net
# Email address of the administrator that lusers can contacts
# if something messes up.
ServerName p504.as1.castleblaney1.eircom.net
# Your servername. The loopback address (loclhost/127.0.0.1)
# is perfectly acceptable.
### NOTE:
### MOST OF THE NEXT FEW LINES ARE EXPLAINED IN FULL
### IN MY .HTACCESS TUTORIAL. SO READ THAT IF YOU GET
### CAUGHT UP ON SOMETHING!
DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"
# Where Apache finds the webpages
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "C:/Program Files/Apache Group/Apache/htdocs">
Options All MultiViews
AllowOverride All
# whether to accept .htaccess files
Order allow,deny
Allow from all
</Directory>
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
AccessFileName .htaccess
# Leave this at .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
# Don't let folks see any files beginning with .ht (eg: .htaccess, .htpasswd)
UseCanonicalName On
<IfModule mod_mime.c>
TypesConfig conf/mime.types
</IfModule>
DefaultType text/plain
# Default mime times.
HostnameLookups Off
# Whether to log hostnames or just IP addresses.
ErrorLog logs/error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog logs/access.log common
ServerSignature On
# Whether to include the server type on server pages (eg. default error 500 pages).
# Some paranoid folk might want to set this to ``Off``
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
ScriptAlias /php/ "C:/php/"
Action application/x-httpd-php4 "/php/php.exe"
AddType application/x-httpd-php4 .php
AddType application/x-httpd-php4 .php3
# This has to do with the way Apache processes PHP/CGI
<Directory "C:/Program Files/Apache Group/Apache/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
# Setting the permissions for the cgi-bin.
</IfModule>
<IfModule mod_autoindex.c>
IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
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
</IfModule>
# That long-winded segment just locates the icons for when there
# is no index page in a directory and directory browsing is set on.
<IfModule mod_mime.c>
AddEncoding x-compress Z
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage he .he
AddCharset ISO-8859-8 .iso8859-8
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage kr .kr
AddCharset ISO-2022-KR .iso-kr
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .sv
AddLanguage cz .cz
AddLanguage ru .ru
AddLanguage tw .tw
AddLanguage zh-tw .tw
AddCharset Big5 .Big5 .big5
AddCharset WINDOWS-1251 .cp-1251
AddCharset CP866 .cp866
AddCharset ISO-8859-5 .iso-ru
AddCharset KOI8-R .koi8-r
AddCharset UCS-2 .ucs2
AddCharset UCS-4 .ucs4
AddCharset UTF-8 .utf8
<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>
# Foreign languages. Bleh.
AddType application/x-tar .tgz
</IfModule>
Final notes
-----------
This is only pretty much *my* basic configuration of the Apache httpd
server. Parts have been removed/included simply for clarity sakes.
Also, a lot of the Apache configuration can reside in .htaccess files,
which affect only the directory its in and all of that directory's
sub-directories.
Conclusions
-----------
As you can see, the conf file is pretty self-documenting and shouldn't
be hard to configure. For more information/documentation or to
download the actual Apache http server itself. Visit:
<http://www.apache.org>
Welcome to the Apache community :0)
Have fun,
Jethro
-
July 2nd, 2002, 07:56 PM
#2
Banned
Realy cool tut, I love using apache 'cause my friends think it is really hard to setup, lol, makes me look all the smarter. And Jethro, if you post too many tuts ya won't get as many greenies for 'em man, 'cause people will have ta balance 'em out!
-
July 2nd, 2002, 09:19 PM
#3
Yes, but I don't post tutorials for AntiPoints. AntiPoints are really just moralising boosts and have no real value, if you get what I'm saying.
Whenever I write a tutorial I decide whether I should post it here or not. If I was in it for the AntiPoints, I wouldn't be doing things like combining three tutorials into the one thread, I'd post them individually.
Thanks for the complement though
Originally posted here by khakisrule
Realy cool tut, I love using apache 'cause my friends think it is really hard to setup, lol, makes me look all the smarter. And Jethro, if you post too many tuts ya won't get as many greenies for 'em man, 'cause people will have ta balance 'em out!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|