-->

Previous | Table of Contents | Next

Page 170

Listing 9.2. continued


# IndexIgnore is a set of filenames which directory indexing should ignore

# Format: IndexIgnore name1 name2...



IndexIgnore */.??* *~ *# */HEADER* */README* */RCS



# AccessFileName: The name of the file to look for in each directory

# for access control information.



AccessFileName .htaccess



# DefaultType is the default MIME type for documents which the server

# cannot find the type of from filename extensions.



DefaultType text/plain



# AddEncoding allows you to have certain browsers (Mosaic/X 2.1+) uncompress

# information on the fly. Note: Not all browsers support this.



AddEncoding x-compress Z

AddEncoding x-gzip gz



# AddLanguage allows you to specify the language of a document. You can

# then use content negotiation to give a browser a file in a language

# it can understand.  Note that the suffix does not have to be the same

# as the language keyword --- those with documents in Polish (whose

# net-standard language code is pl) may wish to use "AddLanguage pl .po"

# to avoid the ambiguity with the common suffix for perl scripts.



AddLanguage en .en

AddLanguage fr .fr

AddLanguage de .de

AddLanguage da .da

AddLanguage el .el

AddLanguage it .it



# LanguagePriority allows you to give precedence to some languages

# in case of a tie during content negotiation.

# Just list the languages in decreasing order of preference.



LanguagePriority en fr de



# Redirect allows you to tell clients about documents which used to exist in

# your server's namespace, but do not anymore. This allows you to tell the

# clients where to look for the relocated document.

# Format: Redirect fakename url





# Aliases: Add here as many aliases as you need (with no limit). The format is

# Alias fakename realname



#Alias /icons/ /usr/local/etc/httpd/icons/



# ScriptAlias: This controls which directories contain server scripts.

# Format: ScriptAlias fakename realname

Page 171


#ScriptAlias /cgi-bin/ /usr/local/etc/httpd/cgi-bin/



# If you want to use server side includes, or CGI outside

# ScriptAliased directories, uncomment the following lines.



# AddType allows you to tweak mime.types without actually editing it, or to

# make certain files to be certain types.

# Format: AddType type/subtype ext1



# AddHandler allows you to map certain file extensions to "handlers",

# actions unrelated to filetype. These can be either built into the server

# or added with the Action command (see below)

# Format: AddHandler action-name ext1



# To use CGI scripts:

#AddHandler cgi-script .cgi



# To use server-parsed HTML files

#AddType text/html .shtml

#AddHandler server-parsed .shtml



# Uncomment the following line to enable Apache's send-asis HTTP file

# feature

#AddHandler send-as-is asis



# If you wish to use server-parsed imagemap files, use

#AddHandler imap-file map



# To enable type maps, you might want to use

#AddHandler type-map var



# Action lets you define media types that will execute a script whenever

# a matching file is called. This eliminates the need for repeated URL

# pathnames for oft-used CGI file processors.

# Format: Action media/type /cgi-script/location

# Format: Action handler-name /cgi-script/location



# For example to add a footer (footer.html in your document root) to

# files with extension .foot (e.g. foo.html.foot), you could use:

#AddHandler foot-action foot

#Action foot-action /cgi-bin/footer



# Or to do this for all HTML files, for example, use:

#Action text/html /cgi-bin/footer



# MetaDir: specifies the name of the directory in which Apache can find

# meta information files. These files contain additional HTTP headers

# to include when sending the document



#MetaDir .web



# MetaSuffix: specifies the file name suffix for the file containing the

# meta information.



#MetaSuffix .meta




                                                                    continues

Page 172

Listing 9.2. continued


# Customizable error response (Apache style)

#  these come in three flavors

#

#    1) plain text

#ErrorDocument 500 "The server made a boo boo.

#  n.b.  the (") marks it as text, it does not get output

#

#    2) local redirects

#ErrorDocument 404 /missing.html

#  to redirect to local url /missing.html

#ErrorDocument 404 /cgi-bin/missing_handler.pl

#  n.b. can redirect to a script or a document using server-side-includes.

#

#    3) external redirects

#ErrorDocument 402 http://other.server.com/subscription_info.html

#

Listing 9.3 shows the global access configuration file.

Listing 9.3. conf/access.conf.


# access.conf: Global access configuration

# Online docs at http://www.apache.org/



# This file defines server settings which affect which types of services

# are allowed, and in what circumstances.



# Each directory to which Apache has access can be configured with respect

# to which services and features are allowed and/or disabled in that

# directory (and its subdirectories).



# Originally by Rob McCool



# This should be changed to whatever you set DocumentRoot to.



<Directory /home/httpd/html>



# 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 (or at least, not yet).



Options Indexes FollowSymLinks



# 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.

Page 173


order allow,deny

allow from all



</Directory>



# /usr/local/etc/httpd/cgi-bin should be changed to wherever your ScriptAliased

# CGI directory exists, if you have that configured.



<Directory /home/httpd/cgi-bin>

AllowOverride None

Options None

</Directory>



# Allow server status reports, with the URL of http://servername/status

# Change the ".nowhere.com" to match your domain to enable.



#<Location /status>

#SetHandler server-status



#order deny,allow

#deny from all

#allow from .nowhere.com

#</Location>



# You may place any other directories or locations you wish to have

# access information for after this one.

Summary

Congratulations! At this point, you should have a properly configured Apache server running. Several advanced options are available for Web sites running Apache, so you should check out the online documentation available at http://www.apache.org/docs/ and the periodic articles available at http://www.webweek.com/. You can also subscribe to a weekly mailing from Web Week that will keep you informed about the latest developments in the Apache project. Reading about the Apache project itself, at http://www.apache.org/ABOUT_APACHE.html, is also particularly interesting. You can also find some fascinating information about the development of the World Wide Web at http://www.webhistory.org/. If you are interested in Perl and CGI programming, you might want to take a look at the Apache/Perl integration project at http://perl.apache.org/. Finally, if you have other operating systems on other machines, remember that Apache is available for a variety of other platforms, including OS/2 and, very soon now, Windows. (The beta version of Apache 1.3 does have Windows support, but this product isn't in its final and stable form yet.) Of course, real Web sites run on Red Hat!

Previous | Table of Contents | Next