From: (no author) <(no author)@unknown> Date: Wed, 20 Mar 2002 05:54:26 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch 'avendor'. X-Git-Tag: PCRE_3_9~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0422abcb411682021eba8960ae701100a38fed43;p=thirdparty%2Fapache%2Fhttpd.git This commit was manufactured by cvs2svn to create branch 'avendor'. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/avendor@94035 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/BuildBin.dsp b/BuildBin.dsp new file mode 100644 index 00000000000..628c7b6d679 --- /dev/null +++ b/BuildBin.dsp @@ -0,0 +1,97 @@ +# Microsoft Developer Studio Project File - Name="BuildBin" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=BuildBin - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "BuildBin.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "BuildBin.mak" CFG="BuildBin - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "BuildBin - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE "BuildBin - Win32 Debug" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "BuildBin - Win32 Release" + +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "" +# PROP BASE Intermediate_Dir "" +# PROP BASE Cmd_Line "NMAKE /f makefile.win" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "\Apache2.0\bin\Apache.exe" +# PROP BASE Bsc_Name ".\Browse\BuildBin.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "" +# PROP Cmd_Line "NMAKE /f makefile.win INSTDIR="\Apache2" _dummy" +# PROP Rebuild_Opt "" +# PROP Target_File "\Apache2\bin\Apache.exe" +# PROP Bsc_Name ".\Browse\Apache.bsc" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "BuildBin - Win32 Debug" + +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "" +# PROP BASE Intermediate_Dir "" +# PROP BASE Cmd_Line "NMAKE /f makefile.win" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "\Apache2.0\bin\Apache.exe" +# PROP BASE Bsc_Name ".\Browse\BuildBin.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "" +# PROP Cmd_Line "NMAKE /f makefile.win INSTDIR="\Apache2" _dummy" +# PROP Rebuild_Opt "" +# PROP Target_File "\Apache2\bin\Apache.exe" +# PROP Bsc_Name ".\Browse\Apache.bsc" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "BuildBin - Win32 Release" +# Name "BuildBin - Win32 Debug" + +!IF "$(CFG)" == "BuildBin - Win32 Release" + +!ELSEIF "$(CFG)" == "BuildBin - Win32 Debug" + +!ENDIF + +# Begin Source File + +SOURCE=.\os\win32\BaseAddr.ref +# End Source File +# Begin Source File + +SOURCE=.\CHANGES +# End Source File +# Begin Source File + +SOURCE=.\Makefile.win +# End Source File +# Begin Source File + +SOURCE=.\STATUS +# End Source File +# End Target +# End Project diff --git a/NWGNUmakefile b/NWGNUmakefile new file mode 100644 index 00000000000..39af31185e1 --- /dev/null +++ b/NWGNUmakefile @@ -0,0 +1,400 @@ +# +# Declare the sub-directories to be built here +# + +SUBDIRS = \ + srclib\apr \ + build \ + support \ + modules \ + $(EOLIST) + +# +# Get the 'head' of the build environment. This includes default targets and +# paths to tools +# + +include $(AP_WORK)\build\NWGNUhead.inc + +# +# build this level's files + +# +# Make sure all needed macro's are defined +# + +# +# These directories will be at the beginning of the include list, followed by +# INCDIRS +# +XINCDIRS += \ + $(AP_WORK)/srclib/apr/include \ + $(AP_WORK)/srclib/include/arch/NetWare \ + $(AP_WORK)/srclib/apr-util/include \ + $(AP_WORK)/include \ + $(AP_WORK)/modules/filters/ \ + $(AP_WORK)/modules/generators/ \ + $(AP_WORK)/modules/http/ \ + $(AP_WORK)/modules/loggers/ \ + $(AP_WORK)/modules/mappers/ \ + $(AP_WORK)/modules/proxy/ \ + $(AP_WORK)/os/NetWare \ + $(AP_WORK)/server/mpm/NetWare \ + $(AP_WORK)/srclib/pcre \ + $(NWOS) \ + $(EOLIST) + +# +# These flags will come after CFLAGS +# +XCFLAGS += \ + $(EOLIST) + +# +# These defines will come after DEFINES +# +XDEFINES += \ + $(EOLIST) + +# +# These flags will be added to the link.opt file +# +XLFLAGS += \ + $(EOLIST) + +# +# These values will be appended to the correct variables based on the value of +# RELEASE +# +ifeq "$(RELEASE)" "debug" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "noopt" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "release" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +# +# These are used by the link target if an NLM is being generated +# This is used by the link 'name' directive to name the nlm. If left blank +# TARGET_nlm (see below) will be used. +# +NLM_NAME = Apache2 + +# +# This is used by the link '-desc ' directive. +# If left blank, NLM_NAME will be used. +# +NLM_DESCRIPTION = Apache Web Server + +# +# This is used by the '-threadname' directive. If left blank, +# NLM_NAME Thread will be used. +# +NLM_THREAD_NAME = Apache +# +# If this is specified, it will override VERSION value in +# $(AP_WORK)\build\NWGNUenvironment.inc +# +NLM_VERSION = + +# +# If this is specified, it will override the default of 64K +# +NLM_STACK_SIZE = 65536 + + +# +# If this is specified it will be used by the link '-entry' directive +# +NLM_ENTRY_SYM = _LibCPrelude + +# +# If this is specified it will be used by the link '-exit' directive +# +NLM_EXIT_SYM = _LibCPostlude + +# +# If this is specified it will be used by the link '-check' directive +# +NLM_CHECK_SYM = _LibCCheckUnload + +# +# If these are specified it will be used by the link '-flags' directive +# +NLM_FLAGS = PSEUDOPREEMPTION + +# +# If this is specified it will be linked in with the XDCData option in the def +# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled +# by setting APACHE_UNIPROC in the environment +# +XDCDATA = + +# +# If there is an NLM target, put it here +# +TARGET_nlm = \ + $(OBJDIR)/Apache2.nlm \ + $(EOLIST) + +# +# If there is an LIB target, put it here +# +TARGET_lib = \ + $(EOLIST) + +# +# These are the OBJ files needed to create the NLM target above. +# Paths must all use the '/' character +# +FILES_nlm_objs = \ + $(OBJDIR)/buildmark.o \ + $(OBJDIR)/config.o \ + $(OBJDIR)/connection.o \ + $(OBJDIR)/core.o \ + $(OBJDIR)/error_bucket.o \ + $(OBJDIR)/http_core.o \ + $(OBJDIR)/http_protocol.o \ + $(OBJDIR)/http_request.o \ + $(OBJDIR)/listen.o \ + $(OBJDIR)/log.o \ + $(OBJDIR)/main.o \ + $(OBJDIR)/mod_access.o \ + $(OBJDIR)/mod_actions.o \ + $(OBJDIR)/mod_alias.o \ + $(OBJDIR)/mod_asis.o \ + $(OBJDIR)/mod_auth.o \ + $(OBJDIR)/mod_autoindex.o \ + $(OBJDIR)/mod_dir.o \ + $(OBJDIR)/mod_env.o \ + $(OBJDIR)/mod_imap.o \ + $(OBJDIR)/mod_include.o \ + $(OBJDIR)/mod_log_config.o \ + $(OBJDIR)/mod_mime.o \ + $(OBJDIR)/mod_negotiation.o \ + $(OBJDIR)/mod_nw_ssl.o \ + $(OBJDIR)/mod_setenvif.o \ + $(OBJDIR)/mod_so.o \ + $(OBJDIR)/mod_userdir.o \ + $(OBJDIR)/modules.o \ + $(OBJDIR)/mpm_common.o \ + $(OBJDIR)/mpm_netware.o \ + $(OBJDIR)/pcre.o \ + $(OBJDIR)/pcreposix.o \ + $(OBJDIR)/protocol.o \ + $(OBJDIR)/request.o \ + $(OBJDIR)/rfc1413.o \ + $(OBJDIR)/scoreboard.o \ + $(OBJDIR)/util.o \ + $(OBJDIR)/util_cfgtree.o \ + $(OBJDIR)/util_charset.o \ + $(OBJDIR)/util_filter.o \ + $(OBJDIR)/util_md5.o \ + $(OBJDIR)/util_nw.o \ + $(OBJDIR)/util_script.o \ + $(OBJDIR)/util_time.o \ + $(OBJDIR)/util_xml.o \ + $(OBJDIR)/vhost.o \ + $(EOLIST) + +# +# These are the LIB files needed to create the NLM target above. +# These will be added as a library command in the link.opt file. +# +FILES_nlm_libs = \ + libcpre.o \ + $(EOLIST) + +# +# These are the modules that the above NLM target depends on to load. +# These will be added as a module command in the link.opt file. +# +FILES_nlm_modules = \ + aprlib \ + Libc \ + $(EOLIST) + +# +# If the nlm has a msg file, put it's path here +# +FILE_nlm_msg = + +# +# If the nlm has a hlp file put it's path here +# +FILE_nlm_hlp = + +# +# If this is specified, it will override $(NWOS)\copyright.txt. +# +FILE_nlm_copyright = + +# +# Any additional imports go here +# +FILES_nlm_Ximports = \ + @netware.imp \ + @$(APR)/aprlib.imp \ + @libc.imp \ + @ws2nlm.imp \ + GetCurrentAddressSpace \ + $(EOLIST) + +# +# Any symbols exported to here +# +FILES_nlm_exports = \ + @$(NWOS)/httpd.imp \ + $(EOLIST) + +# +# These are the OBJ files needed to create the LIB target above. +# Paths must all use the '/' character +# +FILES_lib_objs = \ + $(EOLIST) + +# +# implement targets and dependancies (leave this section alone) +# + +libs :: $(OBJDIR) $(TARGET_lib) + +nlms :: libs $(TARGET_nlm) + +# +# Updated this target to create necessary directories and copy files to the +# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) +# +install :: nlms FORCE + copy $(OBJDIR)\Apache2.nlm $(INSTALL)\Apache2\*.* + -copy ABOUT_APACHE $(INSTALL)\Apache2\*.* + -copy README $(INSTALL)\Apache2\*.* + -copy STATUS $(INSTALL)\Apache2\*.* + -copy LICENSE $(INSTALL)\Apache2\*.* + -copy docs\cgi-examples\*. $(INSTALL)\Apache2\cgi-examples\*.* + -copy docs\conf\httpd-std.conf $(INSTALL)\Apache2\conf\httpd.conf + -copy docs\conf\magic $(INSTALL)\Apache2\conf\magic + -copy docs\conf\mime.types $(INSTALL)\Apache2\conf\mime.types + -copy docs\error\*.* $(INSTALL)\Apache2\error\*.* + -copy docs\error\include\*.* $(INSTALL)\Apache2\error\include\*.* + -copy docs\docroot\*.* $(INSTALL)\Apache2\htdocs\*.* + -copy docs\icons\*.* $(INSTALL)\Apache2\icons\*.* + -copy docs\icons\small\*.* $(INSTALL)\Apache2\icons\small\*.* + -copy docs\man\*.* $(INSTALL)\Apache2\man\*.* + -copy docs\manual\*.* $(INSTALL)\Apache2\manual\*.* + -copy docs\manual\developer\*.* $(INSTALL)\Apache2\manual\developer + -copy docs\manual\faq\*.* $(INSTALL)\Apache2\manual\faq + -copy docs\manual\howto\*.* $(INSTALL)\Apache2\manual\howto + -copy docs\manual\images\*.* $(INSTALL)\Apache2\manual\images + -copy docs\manual\misc\*.* $(INSTALL)\Apache2\manual\misc + -copy docs\manual\mod\*.* $(INSTALL)\Apache2\manual\mod + -copy docs\manual\platform\*.* $(INSTALL)\Apache2\manual\platform + -copy docs\manual\programs\*.* $(INSTALL)\Apache2\manual\programs + -copy docs\manual\search\*.* $(INSTALL)\Apache2\manual\search + -copy docs\manual\vhosts\*.* $(INSTALL)\Apache2\manual\vhosts + +installdev :: FORCE + -copy $(subst /,\,$(AP_WORK))\include\*.h $(INSTALL)\Apache2\include\*.* + -copy $(subst /,\,$(AP_WORK))\os\netware\*.h $(INSTALL)\Apache2\include\*.* + -copy $(subst /,\,$(NWOS))\include\*.h $(INSTALL)\Apache2\include\*.* + -copy $(subst /,\,$(NWOS))\*.imp $(INSTALL)\Apache2\lib\*.* + -copy $(subst /,\,$(APR))\include\*.h $(INSTALL)\Apache2\include\*.* + -copy $(subst /,\,$(APR))\arch\netware\include\*.h $(INSTALL)\Apache2\include\*.* + -copy $(subst /,\,$(APRUTIL))\include\*.h $(INSTALL)\Apache2\include\*.* + -copy $(subst /,\,$(APR))\*.imp $(INSTALL)\Apache2\lib\*.* + +# +# Any specialized rules here +# + +$(OBJDIR)/%.o: server/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: modules/arch/netware/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: modules/http/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: modules/aaa/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: modules/mappers/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: modules/generators/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: modules/metadata/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: modules/filters/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: modules/loggers/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: os/netware/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: server/mpm/netware/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)/%.o: srclib/pcre/%.c $(OBJDIR)\cc.opt + @echo compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +# +# Include the 'tail' makefile that has targets that depend on variables defined +# in this makefile +# + +include $(AP_WORK)\build\NWGNUtail.inc + diff --git a/ROADMAP b/ROADMAP new file mode 100644 index 00000000000..cd45d6d5b58 --- /dev/null +++ b/ROADMAP @@ -0,0 +1,39 @@ +APACHE 2.1+ ROADMAP: + +Last modified at [$Date: 2001/11/27 05:19:39 $] + +DEFERRRED FOR APACHE 2.1 + + * Source code should follow style guidelines. + OK, we all agree pretty code is good. Probably best to clean this + up by hand immediately upon branching a 2.1 tree. + Justin's voulenteered to hand-edit the entire source tree ;) + + * revamp the input filter syntax to provide for ordering of + filters created with the Set{Input|Output}Filter and the + Add{Input|Output}Filter directives. A 'relative to filterx' + syntax is definately preferable, but not realistic for 2.0. + + * Platforms that do not support fork (primarily Win32 and AS/400) + Architect start-up code that avoids initializing all the modules + in the parent process on platforms that do not support fork. + Better yet - not only inform the startup of which phase it's in, + but allow the parent 'process' to initialize shared memory, etc, + and create a module-by-module stream to pass to the child, so the + parent can actually arbitrate the important stuff. + + * Replace stat [deferred open] with open/fstat in directory_walk. + Justin, Ian, OtherBill all interested in this. Implies setting up + the apr_file_t member in request_rec, and having all modules use + that file, and allow the cleanup to close it [if it isn't a shared, + cached file handle.] + + * Refactor auth into auth protocols and auth database stores. + Many interested hackers, too destabilizing for 2.0 inclusion. + +DEFERRRED FOR APACHE 3.0 + + * The Async Apache Server implemented in terms of APR. + [Bill Stoddard's pet project.] + + diff --git a/apachenw.mcp.zip b/apachenw.mcp.zip new file mode 100644 index 00000000000..645099f0737 Binary files /dev/null and b/apachenw.mcp.zip differ diff --git a/build/NWGNUenvironment.inc b/build/NWGNUenvironment.inc new file mode 100644 index 00000000000..76149ad0c8d --- /dev/null +++ b/build/NWGNUenvironment.inc @@ -0,0 +1,286 @@ +# +# Setup needed Tools and Libraries +# + +ifeq "$(wildcard $(AP_WORK)\NWGNUcustom.ini)" "$(AP_WORK)\NWGNUcustom.ini" +include $(AP_WORK)\NWGNUcustom.ini +CUSTOM_INI = $(AP_WORK)\NWGNUcustom.ini +endif + +ifndef VERBOSE +.SILENT: +endif + +# +# Treat like an include +# +ifndef EnvironmentDefined + +# +# simple macros for parsing makefiles +# +EOLIST:= +EMPTY := +COMMA := , +SPACE := $(EMPTY) $(EMPTY) + +# +# Base environment +# + +# Try and handle case issues +ifndef NOVELLLIBC +ifdef NovellLibC +NOVELLLIBC = $(NovellLibC) +endif +endif + +ifndef NOVELLLIBC +NOVELLLIBC = C:/novell/ndk/libc +endif + +# This is a placeholder +# ifndef LDAPSDK +# LDAPSDK = C:/novell/ndk/cldapsdk +# endif + +ifndef METROWERKS +METROWERKS = C:\Program Files\Metrowerks\CodeWarrior +endif + +# If LM_LICENSE_FILE isn't defined, define a variable that can be used to +# restart make with it defined +ifndef LM_LICENSE_FILE +NO_LICENSE_FILE = NO_LICENSE_FILE +endif + +# +# Set the Release type that you want to build, possible values are: +# +# debug - full debug switches are set +# noopt - normal switches are set (default) +# optimized - optimization switches are set + +ifdef reltype +RELEASE=$(reltype) +endif + +ifdef RELTYPE +RELEASE=$(RELTYPE) +endif + +ifdef debug +RELEASE=debug +endif + +ifdef DEBUG +RELEASE=debug +endif + +ifdef optimized +RELEASE=optimized +endif + +ifdef OPTIMIZED +RELEASE=optimized +endif + +ifndef RELEASE +RELEASE = optimized +endif + +ifeq "$(RELEASE)" "debug" +OBJDIR = Debug +endif + +ifeq "$(RELEASE)" "noopt" +OBJDIR = Noopt +endif + +ifeq "$(RELEASE)" "optimized" +OBJDIR = Release +endif + +# +# Setup compiler information +# + +# MetroWerks NLM tools +CC = mwccnlm +CPP = mwccnlm +LINK = mwldnlm +LIB = mwldnlm -type library -w nocmdline + +NOVI = $(NOVELLLIBC)\imports + +INCDIRS = $(NOVELLLIBC)\include;$(NOVELLLIBC)\include\nks;$(NOVELLLIBC)\include\winsock; + +DEFINES = -DNETWARE + +# +# MetroWerks static Libraries + +CLIB3S = $(METROWERKS)\Novell Support\Metrowerks Support\Libraries\Runtime\mwcrtl.lib +MATH3S = +PLIB3S = $(METROWERKS)\Novell Support\Metrowerks Support\Libraries\MSL C++\MWCPP.lib + +# Base compile flags +# and prefix or precompiled header added here. + +# The default flags are as follows: +# +# -c compile only, no link +# -nosyspath treat #include <...> like #include "..." +# -Cpp_exceptions off disable C++ exceptions +# -RTTI off disable C++ run-time typing information +# -align 4 align on 4 byte bounderies +# -w nocmdline disable command-line driver/parser warnings +# -proc PII generate code base on Pentium II instruction set +# -inst mmx use MMX extensions + +CFLAGS = -c -nosyspath -Cpp_exceptions off -RTTI off -align 4 -w nocmdline -proc PII -inst mmx + +# -g generate debugging information +# -O1 level 1 optimizations + +ifeq "$(RELEASE)" "debug" +CFLAGS += -g -O1 +endif + +# -O4,p level 4 optimizations, optimize for speed +ifeq "$(RELEASE)" "optimized" +CFLAGS += -O4,p +endif + +# -prefix pre_nw.h #include pre_nw.h for all files + +CFLAGS += -prefix pre_nw.h + + +PATH:=$(PATH);$(METROWERKS)\bin;$(METROWERKS)\Other Metrowerks Tools\Command Line Tools + +# +# Declare major project deliverables output directories here +# + +ifdef DEST +INSTALL = $(DEST) +ifeq (\, $(findstring \,$(INSTALL))) +INSTDIRS = $(DEST) +endif +endif + +ifdef dest +INSTALL = $(dest) +ifeq (\, $(findstring \,$(INSTALL))) +INSTDIRS = $(dest) +endif +endif + +ifndef INSTALL +INSTALL = $(AP_WORK)\..\Dist +INSTDIRS = $(AP_WORK)\..\Dist +endif + +INSTDEVDIRS := \ + $(INSTDIRS) \ + $(INSTALL)\Apache2\include \ + $(INSTALL)\Apache2\lib \ + +INSTDIRS += \ + $(INSTALL)\Apache2 \ + $(INSTALL)\Apache2\cgi-examples \ + $(INSTALL)\Apache2\conf \ + $(INSTALL)\Apache2\error \ + $(INSTALL)\Apache2\error\include \ + $(INSTALL)\Apache2\htdocs \ + $(INSTALL)\Apache2\icons \ + $(INSTALL)\Apache2\icons\small \ + $(INSTALL)\Apache2\logs \ + $(INSTALL)\Apache2\man \ + $(INSTALL)\Apache2\manual \ + $(INSTALL)\Apache2\manual\developer \ + $(INSTALL)\Apache2\manual\faq \ + $(INSTALL)\Apache2\manual\howto \ + $(INSTALL)\Apache2\manual\images \ + $(INSTALL)\Apache2\manual\misc \ + $(INSTALL)\Apache2\manual\mod \ + $(INSTALL)\Apache2\manual\platform \ + $(INSTALL)\Apache2\manual\programs \ + $(INSTALL)\Apache2\manual\search \ + $(INSTALL)\Apache2\manual\ssl \ + $(INSTALL)\Apache2\manual\vhosts \ + $(INSTALL)\Apache2\modules \ + +# +# Declare Command and tool macros here +# + +# Os2LibPath is an extra check to see if we are on NT +ifdef Os2LibPath +OS = Windows_NT +endif + +ifeq "$(OS)" "Windows_NT" +CMD=cmd /C +CHK=cmd /C if exist +CHKNOT=cmd /C if not exist +DEL = del /F +DELTREE = cmd /C rd /s/q +WINNT=1 +else +CMD=command /C +CHK=command /C if exist +CHKNOT=command /C if not exist +DEL = del +DELTREE = deltree /y +endif + + +# +# Setup base C compiler flags +# + +# +# Common directories +# + +STDMOD = $(AP_WORK)/modules +NWOS = $(AP_WORK)/os/netware +SERVER = $(AP_WORK)/server +SRC = $(AP_WORK) +APR = $(AP_WORK)/srclib/apr +APRUTIL = $(AP_WORK)/srclib/apr-util +SUPMOD = $(AP_WORK)/support +PCRE = $(AP_WORK)/srclib/pcre +APRTEST = $(AP_WORK)/srclib/apr/test +HTTPD = $(AP_WORK)/modules/http +XML = $(AP_WORK)/srclib/apr-util/xml + +# +# Internal Libraries +# + +APRLIB = $(APR)/$(OBJDIR)/aprlib.lib +APRUTLIB = $(APRUTIL)/$(OBJDIR)/aprutil.lib +STMODLIB = $(STDMOD)/$(OBJDIR)/stdmod.lib +PCRELIB = $(PCRE/$(OBJDIR)/pcre.lib +NWOSLIB = $(NWOS)/$(OBJDIR)/netware.lib +SERVLIB = $(SERVER)/$(OBJDIR)/server.lib +HTTPDLIB = $(HTTPD)/$(OBJDIR)/httpd.lib +XMLLIB = $(XML)/$(OBJDIR)/xmllib.lib + +# +# Additional general defines +# +VERSION = 2,0,0 + +EnvironmentDefined = 1 +endif # ifndef EnvironmentDefined + +# This is always set so that it will show up in lower directories + +ifdef Path +Path = $(PATH) +endif + diff --git a/build/NWGNUhead.inc b/build/NWGNUhead.inc new file mode 100644 index 00000000000..71855ab3cd3 --- /dev/null +++ b/build/NWGNUhead.inc @@ -0,0 +1,103 @@ +# +# Obtain the global build environment +# + +include $(AP_WORK)\build\NWGNUenvironment.inc + +# +# Define base targets and rules +# + +TARGETS = libs nlms install clobber_libs clobber_nlms clean installdev + +.PHONY : $(TARGETS) default all help $(NO_LICENSE_FILE) + +# Here is where we will use the NO_LICENSE_FILE variable to see if we need to +# restart the make with it defined + +ifdef NO_LICENSE_FILE + +default: NO_LICENSE_FILE + +all: NO_LICENSE_FILE + +install :: NO_LICENSE_FILE + +installdev :: NO_LICENSE_FILE + +NO_LICENSE_FILE : + $(MAKE) $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(METROWERKS)\license.dat" + +else # LM_LICENSE_FILE must be defined so use the real targets + +default: $(SUBDIRS) libs nlms + +all: $(SUBDIRS) libs nlms install + +$(TARGETS) :: $(SUBDIRS) + +install :: nlms $(INSTDIRS) + +installdev :: $(INSTDEVDIRS) + +$(INSTDIRS) :: + $(CHKNOT) $@\NUL mkdir $@ + +$(INSTDEVDIRS) :: + $(CHKNOT) $@\NUL mkdir $@ + +endif #NO_LICENSE_FILE check + +help : + @echo targets for RELEASE=$(RELEASE): + @echo (default) . . . . libs nlms + @echo all . . . . . . . does everything (libs nlms install) + @echo libs. . . . . . . builds all libs + @echo nlms. . . . . . . builds all nlms + @echo install . . . . . builds libs and nlms and copies install files to + @echo "$(INSTALL)" + @echo clean . . . . . . deletes $(OBJDIR) dirs, *.err, and *.map + @echo clobber_all . . . deletes all possible output from the make + @echo clobber_install . deletes all files in $(INSTALL) + @$(CMD) echo. + @echo Multiple targets can be used on a single nmake command line - + @echo (i.e. $(MAKE) clean all) + @$(CMD) echo. + @echo You can also specify RELEASE=debug, RELEASE=noopt, or RELEASE=optimized + @echo The default is RELEASE=optimized + +clobber_all :: clean clobber_install + +clobber_install :: + -$(DELTREE) $(INSTALL) 2>NUL + +# +# build recursive targets +# + +$(SUBDIRS) : FORCE +ifneq "$(MAKECMDGOALS)" "clean" + $(CMD) echo. + @echo Building $(CURDIR)/$@ +endif + $(MAKE) -C $@ $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(LM_LICENSE_FILE)" + $(CMD) echo. + +FORCE: + +# +# Standard targets +# + +clean :: $(SUBDIRS) + @echo Cleaning up $(CURDIR) + -$(DELTREE) $(OBJDIR) 2> NUL + $(CHK) *.err $(DEL) *.err + $(CHK) *.map $(DEL) *.map + $(CHK) *.d $(DEL) *.d + $(CHK) *.tmp $(DEL) *.tmp + -$(DELTREE) $(OBJDIR) 2> NUL + +$(OBJDIR) :: + $(CHKNOT) $(OBJDIR)\nul mkdir $(OBJDIR) + diff --git a/build/NWGNUmakefile b/build/NWGNUmakefile new file mode 100644 index 00000000000..deeef84fa27 --- /dev/null +++ b/build/NWGNUmakefile @@ -0,0 +1,80 @@ +# +# Declare the sub-directories to be built here +# + +SUBDIRS = \ + $(EOLIST) + +# +# Get the 'head' of the build environment. This includes default targets and +# paths to tools +# + +include $(AP_WORK)\build\NWGNUhead.inc + +# +# build this level's files + +FILES_prebuild_headers = \ + $(APR)/include/apr.h \ + $(APRUTIL)/include/apu.h \ + $(APRUTIL)/include/apr_ldap.h \ + $(PCRE)/config.h \ + $(PCRE)/pcre.h \ + $(EOLIST) + +nlms :: $(NWOS)/httpd.imp + +$(NWOS)/httpd.imp : make_nw_export.awk nw_export.i + @echo Generating $(subst /,\,$@) + awk -f make_nw_export.awk nw_export.i | sort >$(NWOS)/httpd.imp + +nw_export.i : nw_export.inc $(FILES_prebuild_headers) cc.opt + @echo Generating $(subst /,\,$@) + $(CC) $< @cc.opt + +cc.opt : NWGNUmakefile $(AP_WORK)\build\NWGNUenvironment.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUhead.inc + $(CHK) $@ $(DEL) $@ + @echo -P >> $@ + @echo -EP >> $@ + @echo -nosyspath >> $@ + @echo -w nocmdline >> $@ + @echo -DNETWARE >> $@ + @echo -DCORE_PRIVATE >> $@ + @echo -I..\include >> $@ + @echo -I..\modules\http >> $@ + @echo -I..\os\netware >> $@ + @echo -I..\server\mpm\netware >> $@ + @echo -I..\srclib\apr\include >> $@ + @echo -I..\srclib\apr-util\include >> $@ + @echo -ir $(NOVELLLIBC) >> $@ + +$(APR)/include/%.h: $(subst /,\,$(APR))\include\%.hnw + @echo Creating $(subst /,\,$@) + copy $< $(subst /,\,$(APR))\include\$(@F) + +$(APRUTIL)/include/%.h: $(subst /,\,$(APRUTIL))\include\%.hnw + @echo Creating $(subst /,\,$@) + copy $< $(subst /,\,$(APRUTIL))\include\$(@F) + +$(PCRE)/%.h: $(subst /,\,$(PCRE))\%.hw + @echo Creating $(subst /,\,$@) + copy $< $(subst /,\,$(PCRE))\$(@F) + +# +# You can use this target if all that is needed is to copy files to the +# installation area +# +install :: nlms FORCE + + +clean :: + $(CHK) nw_export.i $(DEL) nw_export.i + $(CHK) cc.opt $(DEL) cc.opt + $(CHK) $(subst /,\,$(APR))\include\apr.h $(DEL) $(subst /,\,$(APR))\include\apr.h + $(CHK) $(subst /,\,$(APRUTIL))\include\apu.h $(DEL) $(subst /,\,$(APRUTIL))\include\apu.h + $(CHK) $(subst /,\,$(APRUTIL))\include\apr_ldap.h $(DEL) $(subst /,\,$(APRUTIL))\include\apr_ldap.h + $(CHK) $(subst /,\,$(PCRE))\config.h $(DEL) $(subst /,\,$(PCRE))\config.h + $(CHK) $(subst /,\,$(PCRE))\pcre.h $(DEL) $(subst /,\,$(PCRE))\pcre.h + $(CHK) $(subst /,\,$(NWOS))\httpd.imp $(DEL) $(subst /,\,$(NWOS))\httpd.imp + diff --git a/build/NWGNUtail.inc b/build/NWGNUtail.inc new file mode 100644 index 00000000000..015f197cbc4 --- /dev/null +++ b/build/NWGNUtail.inc @@ -0,0 +1,287 @@ +# +# This contains final targets and should be included at the end of any +# NWGNUmakefile file +# + +# +# If we are going to create an nlm, make sure we have assigned variables to +# use during the link. +# +echo NLM_NAME=$(NLM_NAME) +ifndef NLM_NAME +NLM_NAME = $(TARGET_nlm) +endif + +ifndef NLM_DESCRIPTION +NLM_DESCRIPTION = $(NLM_NAME) +endif + +ifndef NLM_THREAD_NAME +NLM_THREAD_NAME = $(NLM_NAME) Thread +endif + +# +# Create dependency lists based on the files available +# + +CCOPT_DEPENDS = \ + $(AP_WORK)\build\NWGNUhead.inc \ + $(AP_WORK)\build\NWGNUenvironment.inc \ + $(AP_WORK)\build\NWGNUtail.inc \ + NWGNUmakefile \ + $(CUSTOM_INI) \ + $(EOLIST) + +CPPOPT_DEPENDS = \ + $(AP_WORK)\build\NWGNUhead.inc \ + $(AP_WORK)\build\NWGNUenvironment.inc \ + $(AP_WORK)\build\NWGNUtail.inc \ + NWGNUmakefile \ + $(CUSTOM_INI) \ + $(EOLIST) + +$(NLM_NAME)_LINKOPT_DEPENDS = \ + $(TARGET_lib) \ + $(AP_WORK)\build\NWGNUenvironment.inc \ + NWGNUmakefile \ + $(AP_WORK)\build\NWGNUtail.inc \ + $(CUSTOM_INI) \ + $(EOLIST) + +ifeq "$(words $(strip $(TARGET_lib)))" "1" +LIB_NAME = $(basename $(notdir $(TARGET_lib))) +$(LIB_NAME)_LIBLST_DEPENDS = \ + $(FILES_lib_objs) \ + $(AP_WORK)\build\NWGNUenvironment.inc \ + NWGNUmakefile \ + $(AP_WORK)\build\NWGNUtail.inc \ + $(CUSTOM_INI) \ + $(EOLIST) +endif + +ifeq "$(wildcard NWGNU$(LIB_NAME))" "NWGNU$(LIB_NAME)" +$(LIB_NAME)_LIBLST_DEPENDS += NWGNU$(LIB_NAME) +endif + +ifeq "$(wildcard NWGNU$(NLM_NAME))" "NWGNU$(NLM_NAME)" +$(NLM_NAME)_LINKOPT_DEPENDS += NWGNU$(NLM_NAME) +CCOPT_DEPENDS += NWGNU$(NLM_NAME) +CPPOPT_DEPENDS += NWGNU$(NLM_NAME) +endif + +# +# Generic compiler rules +# + +$(OBJDIR)/%.o: %.c $(OBJDIR)\cc.opt + @echo Compiling $< + $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt + +$(OBJDIR)\cc.opt: $(CCOPT_DEPENDS) + $(CHK) $@ $(DEL) $@ + @echo Generating $@ +ifneq "$(strip $(CFLAGS))" "" + @echo $(CFLAGS) >> $@ +endif +ifneq "$(strip $(XCFLAGS))" "" + @echo $(XCFLAGS) >> $@ +endif +ifneq "$(strip $(XINCDIRS))" "" + @echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@ +endif +ifneq "$(strip $(INCDIRS))" "" + @echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@ +endif +ifneq "$(strip $(DEFINES))" "" + @echo $(DEFINES) >> $@ +endif +ifneq "$(strip $(XDEFINES))" "" + @echo $(XDEFINES) >> $@ +endif + +$(OBJDIR)/%.o: %.cpp $(OBJDIR)\cpp.opt + @echo Compiling $< + $(CPP) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cpp.opt + +$(OBJDIR)\cpp.opt: $(CPPOPT_DEPENDS) + $(CHK) $@ $(DEL) $@ + @echo Generating $@ +ifneq "$(strip $(CFLAGS))" "" + @echo $(CFLAGS) >> $@ +endif +ifneq "$(strip $(XCFLAGS))" "" + @echo $(XCFLAGS) >> $@ +endif +ifneq "$(strip $(XINCDIRS))" "" + @echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@ +endif +ifneq "$(strip $(INCDIRS))" "" + @echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@ +endif +ifneq "$(strip $(DEFINES))" "" + @echo $(DEFINES) >> $@ +endif +ifneq "$(strip $(XDEFINES))" "" + @echo $(XDEFINES) >> $@ +endif + +# +# Rules to build libraries +# + +# If we only have one target library then build it + +ifeq "$(words $(strip $(TARGET_lib)))" "1" + +$(TARGET_lib) : $(OBJDIR)\$(LIB_NAME)_lib.lst + @echo Generating $@ + $(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F) + $(LIB) -o $(OBJDIR)\$(@F) @$? + +$(OBJDIR)\$(LIB_NAME)_lib.lst: $($(LIB_NAME)_LIBLST_DEPENDS) + $(CHK) $@ $(DEL) $@ + @echo Generating $@ +ifneq "$(strip $(FILES_lib_objs))" "" + @echo $(foreach objfile,$(FILES_lib_objs),$(subst /,\,$(objfile)) ) >> $@ +endif + +else # We must have more than one target library so load the individual makefiles + +$(OBJDIR)/%.lib: NWGNU% $(AP_WORK)\build\NWGNUhead.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUenvironment.inc FORCE + @echo Calling $< + $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE) + +endif + +# +# Rules to build nlms. +# + +vpath libcpre.o $(NOVELLLIBC)\imports + +# If we only have one target NLM then build it +ifeq "$(words $(strip $(TARGET_nlm)))" "1" + +$(TARGET_nlm) : $(FILES_nlm_objs) $(FILES_nlm_libs) $(OBJDIR)\$(NLM_NAME)_link.opt + @echo Linking $@ + $(LINK) @$(OBJDIR)\$(NLM_NAME)_link.opt + +# This will force the link option file to be rebuilt if we change the +# corresponding makefile + +$(OBJDIR)\$(NLM_NAME)_link.opt : $($(NLM_NAME)_LINKOPT_DEPENDS) + $(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F) + $(CHK) $(OBJDIR)\$(NLM_NAME)_link.def $(DEL) $(OBJDIR)\$(NLM_NAME)_link.def + @echo Generating $@ + @echo -warnings off >> $@ + @echo -zerobss >> $@ + @echo -desc "$(NLM_DESCRIPTION)" >> $@ + @echo -o $(TARGET_nlm) >> $@ +ifneq "$(FILE_nlm_copyright)" "" + @-type $(FILE_nlm_copyright) >> $@ +endif +ifeq "$(RELEASE)" "debug" + @echo -g >> $@ + @echo -sym internal >> $@ + @echo -sym codeview4 >> $@ + @echo -osym $(OBJDIR)\$(NLM_NAME).sym >> $@ +else + @echo -sym internal >> $@ +endif + @echo -screenname "Apache for NetWare" >> $@ +ifneq "$(NLM_VERSION)" "" + @echo -nlmversion=$(NLM_VERSION) >> $@ +else + @echo -nlmversion=$(VERSION) >> $@ +endif + @echo -l $(NWOS) >> $@ + @echo -l $(AP)/$(OBJDIR) >> $@ + @echo -l $(APR)/$(OBJDIR) >> $@ + @echo -l $(APRUTIL)/$(OBJDIR) >> $@ + @echo -l $(PCRE)/$(OBJDIR) >> $@ + @echo -l $(HTTPD)/$(OBJDIR) >> $@ + @echo -l $(SERVER)/$(OBJDIR) >> $@ + @echo -l $(STDMOD)/$(OBJDIR) >> $@ + @echo -l $(NWOS)/$(OBJDIR) >> $@ + @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime" >> $@ + @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++" >> $@ + @echo -l $(NOVELLLIBC)/imports >> $@ +ifneq "$(LDAPSDK)" "" + @echo -l $(LDAPSDK)/lib/nlm >> $@ +endif + @echo -l $(XML)/$(OBJDIR) >> $@ + @echo -nodefaults >> $@ + @echo -map $(OBJDIR)\$(NLM_NAME).map>> $@ + @echo -threadname "$(NLM_THREAD_NAME)" >> $@ +ifneq "$(NLM_STACK_SIZE)" "" + @echo -stacksize $(subst K,000,$(subst k,K,$(strip $(NLM_STACK_SIZE)))) >> $@ +else + @echo -stacksize 64000 >> $@ +endif +ifneq "$(NLM_ENTRY_SYM)" "" + @echo -entry $(NLM_ENTRY_SYM) >> $@ +endif +ifneq "$(NLM_EXIT_SYM)" "" + @echo -exit $(NLM_EXIT_SYM) >> $@ +endif +ifneq "$(NLM_CHECK_SYM)" "" + @echo -check $(NLM_CHECK_SYM) >> $@ +endif +ifneq "$(NLM_FLAGS)" "" + @echo -flags $(NLM_FLAGS) >> $@ +endif +ifneq "$(strip $(FILES_nlm_objs))" "" + @echo $(foreach objfile,$(strip $(FILES_nlm_objs)),$(subst /,\,$(objfile))) >> $@ +endif +ifneq "$(FILES_nlm_libs)" "" + @echo $(foreach libfile, $(notdir $(strip $(FILES_nlm_libs))),-l$(subst /,\,$(libfile))) >> $@ +endif + @echo -commandfile $(OBJDIR)\$(NLM_NAME)_link.def >> $@ +ifneq "$(FILE_nlm_msg)" "" + @echo Messages $(FILE_nlm_msg) >> $(OBJDIR)\$(NLM_NAME)_link.def +endif +ifneq "$(FILE_nlm_hlp)" "" + @echo Help $(FILE_nlm_hlp) >> $(OBJDIR)\$(NLM_NAME)_link.def +endif +ifneq "$(FILES_nlm_modules)" "" + @echo module $(foreach module,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_modules))),$(subst /,\,$(module))) >> $(OBJDIR)\$(NLM_NAME)_link.def +endif +ifneq "$(FILES_nlm_Ximports)" "" + @echo Import $(foreach import,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_Ximports))),$(subst /,\,$(import))) >> $(OBJDIR)\$(NLM_NAME)_link.def +endif +ifneq "$(FILES_nlm_exports)" "" + @echo Export $(foreach export,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_exports))),$(subst /,\,$(export))) >> $(OBJDIR)\$(NLM_NAME)_link.def +endif +ifneq "$(strip $(XLFLAGS))" "" + @echo $(XLFLAGS) >> $(OBJDIR)\$(NLM_NAME)_link.def +endif + +# if APACHE_UNIPROC is defined, don't include XDCData +ifndef APACHE_UNIPROC +ifneq "$(string $(XDCDATA))" "" + @echo XDCData $(XDCDATA) >> $(OBJDIR)\$(NLM_NAME)_link.def +else + @echo XDCData $(NWOS)\apache.xdc >> $(OBJDIR)\$(NLM_NAME)_link.def +endif +endif + +else # more than one target so look for individual makefiles. + +# Only include these if NO_LICENSE_FILE isn't set to prevent excessive +# recursion + +ifndef NO_LICENSE_FILE + +$(OBJDIR)/%.nlm: NWGNU% $(AP_WORK)\build\NWGNUhead.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUenvironment.inc $(CUSTOM_INI) FORCE + @echo Calling $< + $(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE) + $(CMD) echo. + +else + +$(TARGET_nlm): + +endif # NO_LICENSE_FILE + +endif + diff --git a/build/install-bindist.sh.in b/build/install-bindist.sh.in new file mode 100755 index 00000000000..0c8a23ed71a --- /dev/null +++ b/build/install-bindist.sh.in @@ -0,0 +1,130 @@ +#!/bin/sh +# +# Usage: install-bindist.sh [ServerRoot] +# This script installs the Apache binary distribution and +# was automatically created by binbuild.sh. + +lmkdir() +{ + path="" + dirs=`echo $1 | sed -e 's%/% %g'` + mode=$2 + + set -- ${dirs} + + for d in ${dirs} + do + path="${path}/$d" + if test ! -d "${path}" ; then + mkdir ${path} + if test $? -ne 0 ; then + echo "Failed to create directory: ${path}" + exit 1 + fi + chmod ${mode} ${path} + fi + done +} + +lcopy() +{ + from=$1 + to=$2 + dmode=$3 + fmode=$4 + + test -d ${to} || lmkdir ${to} ${dmode} + (cd ${from} && tar -cf - *) | (cd ${to} && tar -xf -) + + if test "X${fmode}" != X ; then + find ${to} -type f -print | xargs chmod ${fmode} + fi + if test "X${dmode}" != X ; then + find ${to} -type d -print | xargs chmod ${dmode} + fi +} + +## +## determine path to (optional) Perl interpreter +## +PERL=no-perl5-on-this-system +perls='perl5 perl' +path=`echo $PATH | sed -e 's/:/ /g'` + +for dir in ${path} ; do + for pperl in ${perls} ; do + if test -f "${dir}/${pperl}" ; then + if `${dir}/${pperl} -v | grep 'version 5\.' >/dev/null 2>&1` ; then + PERL="${dir}/${pperl}" + break + fi + fi + done +done + +if [ .$1 = . ] +then + SR=@default_dir@ +else + SR=$1 +fi +echo "Installing binary distribution for platform i686-pc-linux" +echo "into directory $SR ..." +lmkdir $SR 755 +lmkdir $SR/proxy 750 +lmkdir $SR/logs 750 +lcopy bindist/man $SR/man 755 644 +if [ -d bindist/modules ] +then + lcopy bindist/modules $SR/modules 750 750 +fi +lcopy bindist/include $SR/include 755 644 +lcopy bindist/icons $SR/icons 755 644 +lcopy bindist/cgi-bin $SR/cgi-bin 750 750 +lcopy bindist/bin $SR/bin 750 750 +if [ -d $SR/conf ] +then + echo "[Preserving existing configuration files.]" + cp bindist/conf/*-std.conf $SR/conf/ +else + lcopy bindist/conf $SR/conf 750 640 + sed -e "s%@default_dir@%$SR%" $SR/conf/httpd-std.conf > $SR/conf/httpd.conf +fi +if [ -d $SR/htdocs ] +then + echo "[Preserving existing htdocs directory.]" +else + lcopy bindist/htdocs $SR/htdocs 755 644 +fi +if [ -d $SR/error ] +then + echo "[Preserving existing error documents directory.]" +else + lcopy bindist/error $SR/error 755 644 +fi + +sed -e "s;^#!/.*;#!$PERL;" -e "s;\@prefix\@;$SR;" -e "s;\@sbindir\@;$SR/bin;" \ + -e "s;\@libexecdir\@;$SR/libexec;" -e "s;\@includedir\@;$SR/include;" \ + -e "s;\@sysconfdir\@;$SR/conf;" bindist/bin/apxs > $SR/bin/apxs +sed -e "s;^#!/.*;#!$PERL;" bindist/bin/dbmmanage > $SR/bin/dbmmanage +sed -e "s%@default_dir@%$SR%" \ + -e "s%^HTTPD=.*$%HTTPD=\"$SR/bin/httpd -d $SR\"%" bindist/bin/apachectl > $SR/bin/apachectl + +echo "Ready." +echo " +--------------------------------------------------------+" +echo " | You now have successfully installed the Apache @ver@ |" +echo " | HTTP server. To verify that Apache actually works |" +echo " | correctly you should first check the (initially |" +echo " | created or preserved) configuration files: |" +echo " | |" +echo " | $SR/conf/httpd.conf" +echo " | |" +echo " | You should then be able to immediately fire up |" +echo " | Apache the first time by running: |" +echo " | |" +echo " | $SR/bin/apachectl start " +echo " | |" +echo " | Thanks for using Apache. The Apache Group |" +echo " | http://www.apache.org/ |" +echo " +--------------------------------------------------------+" +echo " " diff --git a/build/instdso.sh b/build/instdso.sh new file mode 100755 index 00000000000..c7b5d615648 --- /dev/null +++ b/build/instdso.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# +# instdso.sh - install Apache DSO modules +# +# usually this just passes through to libtool but on a few +# platforms libtool doesn't install DSOs exactly like we'd +# want so more effort is required + +if test "$#" != "3"; then + echo "wrong number of arguments to instdso.sh" + echo "Usage: instdso.sh SH_LIBTOOL-value dso-name path-to-modules" + exit 1 +fi + +SH_LIBTOOL=`echo $1 | sed -e 's/^SH_LIBTOOL=//'` +DSOARCHIVE=$2 +TARGETDIR=$3 +DSOBASE=`echo $DSOARCHIVE | sed -e 's/\.la$//'` +TARGET_NAME="$DSOBASE.so" + +# special logic for systems where libtool doesn't install +# the DSO exactly like we'd want + +SYS=`uname -s` +case $SYS in + AIX) + # on AIX, shared libraries remain in storage even when + # all processes using them have exited; standard practice + # prior to installing a shared library is to rm -f first + CMD="rm -f $TARGETDIR/$TARGET_NAME" + echo $CMD + $CMD || exit $? + CMD="cp .libs/lib$DSOBASE.so.0 $TARGETDIR/$TARGET_NAME" + echo $CMD + $CMD || exit $? + ;; + HP-UX) + CMD="cp .libs/$DSOBASE.sl $TARGETDIR/$TARGET_NAME" + echo $CMD + $CMD || exit $? + ;; + OSF1) + CMD="cp .libs/lib$DSOBASE.so $TARGETDIR/$TARGET_NAME" + echo $CMD + $CMD || exit $? + ;; + *) + CMD="$SH_LIBTOOL --mode=install cp $DSOARCHIVE $TARGETDIR" + echo $CMD + $CMD || exit $? + ;; +esac + +exit 0 diff --git a/build/make_nw_export.awk b/build/make_nw_export.awk new file mode 100644 index 00000000000..317e4bc7c36 --- /dev/null +++ b/build/make_nw_export.awk @@ -0,0 +1,113 @@ +# Based on apr's make_export.awk, which is +# based on Ryan Bloom's make_export.pl + +# List of functions that we don't support, yet?? +/apr_##name##_set_inherit/{next} +/apr_##name##_unset_inherit/{next} +/apr_compare_groups/{next} +/apr_compare_users/{next} +/apr_find_pool/{next} +/apr_generate_random_bytes/{next} +/apr_lock_create_np/{next} +/apr_md5_set_xlate/{next} +/apr_mmap_create/{next} +/apr_mmap_delete/{next} +/apr_mmap_offset/{next} +/apr_os_thread_get/{next} +/apr_os_thread_put/{next} +/apr_pool_free_blocks_num_bytes/{next} +/apr_pool_join/{next} +/apr_pool_num_bytes/{next} +/apr_proc_mutex_child_init/{next} +/apr_proc_mutex_create/{next} +/apr_proc_mutex_create_np/{next} +/apr_proc_mutex_destroy/{next} +/apr_proc_mutex_lock/{next} +/apr_proc_mutex_trylock/{next} +/apr_proc_mutex_unlock/{next} +/apr_proc_other_child_check/{next} +/apr_proc_other_child_read/{next} +/apr_proc_other_child_register/{next} +/apr_proc_other_child_unregister/{next} +/apr_sendfile/{next} +/apr_shm_avail/{next} +/apr_shm_calloc/{next} +/apr_shm_destroy/{next} +/apr_shm_free/{next} +/apr_shm_init/{next} +/apr_shm_malloc/{next} +/apr_shm_name_get/{next} +/apr_shm_name_set/{next} +/apr_shm_open/{next} +/apr_signal/{next} +/apr_signal_thread/{next} +/apr_socket_from_file/{next} +/apr_thread_once/{next} +/apr_thread_once_init/{next} +/apr_xlate_close/{next} +/apr_xlate_conv_buffer/{next} +/apr_xlate_conv_byte/{next} +/apr_xlate_conv_char/{next} +/apr_xlate_get_sb/{next} +/apr_xlate_open/{next} +/apr_brigade_consume/{next} +/apr_bucket_mmap_create/{next} +/apr_bucket_mmap_make/{next} +/apr_bucket_type_mmap/{next} +/apr_md4_set_xlate/{next} +#/XML_ParserFree/{next} +#/XML_ParserCreate/{next} +#/XML_SetUserData/{next} +#/XML_SetElementHandler/{next} +#/XML_SetCharacterDataHandler/{next} +#/XML_Parse/{next} +#/XML_GetErrorCode/{next} +#/XML_ErrorString/{next} + + +function add_symbol (sym_name) { + if (count) { + found++ + } +# for (i = 0; i < count; i++) { +# line = line "\t" +# } + line = line sym_name ",\n" + + if (count == 0) { + printf(" %s", line) + line = "" + } +} + +/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ { + sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "") + sub("[(].*", "") + sub("([^ ]* (^([ \t]*[(])))+", "") + + add_symbol($0) + next +} + +/^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*[)]/ { + split($0, args, ",") + symbol = args[2] + sub("^[ \t]+", "", symbol) + sub("[ \t]+$", "", symbol) + + add_symbol("ap_hook_" symbol) + add_symbol("ap_hook_get_" symbol) + add_symbol("ap_run_" symbol) + next +} + +/^[ \t]*AP[RU]?_DECLARE_DATA .*;$/ { + varname = $NF; + gsub( /[*;]/, "", varname); + gsub( /\[.*\]/, "", varname); + add_symbol(varname); +} + +#END { +# printf(" %s", line) +#} diff --git a/build/mkconfNW.awk b/build/mkconfNW.awk new file mode 100644 index 00000000000..3ec7a51bb19 --- /dev/null +++ b/build/mkconfNW.awk @@ -0,0 +1,59 @@ + + +BEGIN { + + A["ServerRoot"] = "SYS:\APACHE2" + A["Port"] = "80" + +} + +/@@LoadModule@@/ { + print "#LoadModule auth_anon_module modules/authanon.nlm" + print "#LoadModule auth_dbm_module modules/authdbm.nlm" + print "#LoadModule auth_digest_module modules/digest.nlm" + print "#LoadModule cern_meta_module modules/cernmeta.nlm" + print "#LoadModule dav_module modules/mod_dav.nlm" + print "#LoadModule dav_fs_module modules/moddavfs.nlm" + print "#LoadModule expires_module modules/expires.nlm" + print "#LoadModule file_cache_module modules/filecach.nlm" + print "#LoadModule headers_module modules/headers.nlm" + print "#LoadModule info_module modules/info.nlm" + print "#LoadModule mime_magic_module modules/mimemagi.nlm" + print "#LoadModule proxy_module modules/proxy.nlm" + print "#LoadModule proxy_connect_module modules/proxy_connect.nlm" + print "#LoadModule proxy_http_module modules/proxy_http.nlm" + print "#LoadModule proxy_ftp_module modules/proxy_ftp.nlm" + print "#LoadModule rewrite_module modules/rewrite.nlm" + print "#LoadModule speling_module modules/speling.nlm" + print "#LoadModule status_module modules/status.nlm" + print "#LoadModule unique_id_module modules/uniqueid.nlm" + print "#LoadModule usertrack_module modules/usertrk.nlm" + print "#LoadModule vhost_alias_module modules/vhost.nlm" + print "" + next +} + +match ($0,/@@.*@@/) { + s=substr($0,RSTART+2,RLENGTH-4) +# substr($0,RSTART,RLENGTH) = A[s] + sub(/@@.*@@/,A[s],$0) +# print +} + + +{ + print +} + + +END { + print + print "#" + print "# SecureListen: Allows you to securely bind Apache to specific IP addresses " + print "# and/or ports." + print "#" + print "# Change this to SecureListen on specific IP addresses as shown below to " + print "# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)" + print "#" + print "#SecureListen 443 \"SSL CertificateIP\"" +} diff --git a/build/nw_export.inc b/build/nw_export.inc new file mode 100644 index 00000000000..27185ead300 --- /dev/null +++ b/build/nw_export.inc @@ -0,0 +1,47 @@ +/* Must include ap_config.h first so that we can redefine + the standard prototypes macros after it messes with + them. */ +#include "ap_config.h" + +/* Define all of the standard prototype macros as themselves + so that httpd.h will not mess with them. This allows + them to pass untouched so that the AWK script can pick + them out of the preprocessed result file. */ +#define AP_DECLARE AP_DECLARE +#define AP_CORE_DECLARE AP_CORE_DECLARE +#define AP_DECLARE_NONSTD AP_DECLARE_NONSTD +#define AP_CORE_DECLARE_NONSTD AP_CORE_DECLARE_NONSTD +#define AP_DECLARE_HOOK AP_DECLARE_HOOK +#define AP_DECLARE_DATA AP_DECLARE_DATA + +#include "httpd.h" + +/* Preprocess all of the standard HTTPD headers. */ +#include "ap_compat.h" +#include "ap_listen.h" +#include "ap_mmn.h" +#include "ap_mpm.h" +#include "ap_release.h" +#include "http_config.h" +#include "http_connection.h" +#include "http_core.h" +#include "http_log.h" +#include "http_main.h" +#include "http_protocol.h" +#include "http_request.h" +#include "http_vhost.h" +#include "mpm_common.h" +#include "pcreposix.h" +#include "rfc1413.h" +#include "scoreboard.h" +#include "util_cfgtree.h" +#include "util_charset.h" +#include "util_ebcdic.h" +#include "util_filter.h" +/*#include "util_ldap.h"*/ +#include "util_md5.h" +#include "util_script.h" +#include "util_time.h" +#include "util_xml.h" + +#include "mod_core.h" diff --git a/build/prebuildNW.bat b/build/prebuildNW.bat new file mode 100755 index 00000000000..d82be4e6d16 --- /dev/null +++ b/build/prebuildNW.bat @@ -0,0 +1,24 @@ +@echo off +rem # As part of the pre-build process, the utilities GenChars.NLM +rem # (Gen Test Chars) and DFTables.NLM (dftables) must be built, +rem # copied to a NetWare server and run using the following commands: +rem # +rem # genchars >test_char.h +rem # dftables >chartables.c +rem # +rem # The files "sys:\test_chars.h" and "sys:\chartables.c" must be +rem # copied to "httpd\os\netware" on the build machine. + +@echo Fixing up the APR headers +copy ..\srclib\apr\include\apr.hnw ..\srclib\apr\include\apr.h + +@echo Fixing up the APR-Util headers +copy ..\srclib\apr-util\include\apu.h.in ..\srclib\apr-util\include\apu.h + +@echo Fixing up the pcre headers +copy ..\srclib\pcre\config.hw ..\srclib\pcre\config.h +copy ..\srclib\pcre\pcre.hw ..\srclib\pcre\pcre.h + +@echo Generating the import lists... +awk95 -f make_nw_export.awk ..\srclib\apr\include\*.h |sort > ..\os\netware\aprlib.imp +awk95 -f make_nw_export.awk ..\srclib\apr-util\include\*.h |sort > ..\os\netware\aprutil.imp \ No newline at end of file diff --git a/docs/error/README b/docs/error/README new file mode 100644 index 00000000000..6856b7c7eec --- /dev/null +++ b/docs/error/README @@ -0,0 +1,27 @@ + + Multi Language Custom Error Documents + ------------------------------------- + + The 'error' directory in the document root directory contains HTTP error + messages in multiple languages. If the preferred language of client is + available it is selected automatically via the MultiViews feature. + You may configure the design and markup of the documents by modifying + the HTML files in the directory '/error/includes', especially the + file 'config.html'. + + + Supported Languages: + + +------------------+------------------------------------------+ + | Language | Contributed by | + +------------------+------------------------------------------+ + | English (en) | Lars Eilebrecht | + | German (de) | Lars Eilebrecht | + | Spanish (es) | Karla Quintero | + | French (fr) | Cecile de Crecy | + +------------------+------------------------------------------+ + (Please see http://httpd.apache.org/docs-project/ if you would + like to contribute the pages in an additional language.) + + + Copyright (c) 2001 The Apache Software Foundation. All rights reserved. diff --git a/docs/manual/developer/filters.html b/docs/manual/developer/filters.html new file mode 100644 index 00000000000..b8ac610025b --- /dev/null +++ b/docs/manual/developer/filters.html @@ -0,0 +1,168 @@ + + + +
+ + +Warning - this is a cut 'n paste job from an email: + <022501c1c529$f63a9550$7f00000a@KOJ>
+ ++There are three basic filter types (each of these is actually broken +down into two categories, but that comes later). + +CONNECTION: Filters of this type are valid for the lifetime of this + connection. + +PROTOCOL: Filters of this type are valid for the lifetime of this + request from the point of view of the client, this means + that the request is valid from the time that the request + is sent until the time that the response is received. + +RESOURCE: Filters of this type are valid for the time that this + content is used to satisfy a request. For simple + requests, this is identical to PROTOCOL, but internal redirects + and sub-requests can change the content without ending + the request. + +It is important to make the distinction between a protocol and a +resource filter. A resource filter is tied to a specific resource, it +may also be tied to header information, but the main binding is to a +resource. If you are writing a filter and you want to know if it is +resource or protocol, the correct question to ask is: "Can this filter +be removed if the request is redirected to a different resource?" If +the answer is yes, then it is a resource filter. If it is no, then it +is most likely a protocol or connection filter. I won't go into +connection filters, because they seem to be well understood. + +With this definition, a few examples might help: +Byterange: We have coded it to be inserted for all +requests, and it is removed if not used. Because this filter is active +at the beginning of all requests, it can not be removed if it is +redirected, so this is a protocol filter. + +http_header: This filter actually writes the headers to the +network. This is obviously a required filter (except in the asis case +which is special and will be dealt with below) and so it is a protocol +filter. + +Deflate: The administrator configures this filter based on +which file has been requested. If we do an internal redirect from an +autoindex page to an index.html page, the deflate filter may be added or +removed based on config, so this is a resource filter. + +The further breakdown of each category into two more filter types is +strictly for ordering. We could remove it, and only allow for one +filter type, but the order would tend to be wrong, and we would need to +hack things to make it work. Currently, the RESOURCE filters only have +one filter type, but that should change. + +How are filters inserted? +This is actually rather simple in theory, but the code is +complex. First of all, it is important that everybody realize that +there are three filter lists for each request, but they are all +concatenated together. So, the first list is r->output_filters, then +r->proto_output_filters, and finally r->connection->output_filters. +These correspond to the RESOURCE, PROTOCOL, and CONNECTION filters +respectively. The problem previously, was that we used a singly linked +list to create the filter stack, and we started from the "correct" +location. This means that if I had a RESOURCE filter on the stack, and +I added a CONNECTION filter, the CONNECTION filter would be ignored. +This should make sense, because we would insert the connection filter at +the top of the c->output_filters list, but the end of r->output_filters +pointed to the filter that used to be at the front of c->output_filters. +This is obviously wrong. The new insertion code uses a doubly linked +list. This has the advantage that we never lose a filter that has been +inserted. Unfortunately, it comes with a separate set of headaches. + +The problem is that we have two different cases were we use subrequests. +The first is to insert more data into a response. The second is to +replace the existing response with an internal redirect. These are two +different cases and need to be treated as such. + +In the first case, we are creating the subrequest from within a handler +or filter. This means that the next filter should be passed to +make_sub_request function, and the last resource filter in the +sub-request will point to the next filter in the main request. This +makes sense, because the sub-request's data needs to flow through the +same set of filters as the main request. A graphical representation +might help: + +Default_handler --> includes_filter --> byterange --> content_length -> +etc + +If the includes filter creates a sub request, then we don't want the +data from that sub-request to go through the includes filter, because it +might not be SSI data. So, the subrequest adds the following: + +Default_handler --> includes_filter -/-> byterange --> content_length -> etc + / +Default_handler --> sub_request_core + +What happens if the subrequest is SSI data? Well, that's easy, the +includes_filter is a resource filter, so it will be added to the sub +request in between the Default_handler and the sub_request_core filter. + +The second case for sub-requests is when one sub-request is going to +become the real request. This happens whenever a sub-request is created +outside of a handler or filter, and NULL is passed as the next filter to +the make_sub_request function. + +In this case, the resource filters no longer make sense for the new +request, because the resource has changed. So, instead of starting from +scratch, we simply point the front of the resource filters for the +sub-request to the front of the protocol filters for the old request. +This means that we won't lose any of the protocol filters, neither will +we try to send this data through a filter that shouldn't see it. + +The problem is that we are using a doubly-linked list for our filter +stacks now. But, you should notice that it is possible for two lists to +intersect in this model. So, you do you handle the previous pointer? +This is a very difficult question to answer, because there is no "right" +answer, either method is equally valid. I looked at why we use the +previous pointer. The only reason for it is to allow for easier +addition of new servers. With that being said, the solution I chose was +to make the previous pointer always stay on the original request. + +This causes some more complex logic, but it works for all cases. My +concern in having it move to the sub-request, is that for the more +common case (where a sub-request is used to add data to a response), the +main filter chain would be wrong. That didn't seem like a good idea to +me. + +asis: +The final topic. :-) Mod_Asis is a bit of a hack, but the +handler needs to remove all filters except for connection filters, and +send the data. If you are using mod_asis, all other bets are off. + +The absolutely last point is that the reason this code was so hard to +get right, was because we had hacked so much to force it to work. I +wrote most of the hacks originally, so I am very much to blame. +However, now that the code is right, I have started to remove some +hacks. Most people should have seen that the reset_filters and +add_required_filters functions are gone. Those inserted protocol level +filters for error conditions, in fact, both functions did the same +thing, one after the other, it was really strange. Because we don't +lose protocol filters for error cases any more, those hacks went away. +The HTTP_HEADER, Content-length, and Byterange filters are all added in +the insert_filters phase, because if they were added earlier, we had +some interesting interactions. Now, those could all be moved to be +inserted with the HTTP_IN, CORE, and CORE_IN filters. That would make +the code easier to follow. ++ + + + + diff --git a/docs/manual/mod/allmodules.xml b/docs/manual/mod/allmodules.xml new file mode 100644 index 00000000000..ddf557d601a --- /dev/null +++ b/docs/manual/mod/allmodules.xml @@ -0,0 +1,46 @@ +
This directive controls whether requests that contain trailing + pathname information that follows an actual filename (or + non-existent file in an existing directory) will be accepted or + rejected. The trailing pathname information can be made + available to scripts in the PATH_INFO environment variable.
+ +For example, assume the location /test/
points to
+ a directory that contains only the single file
+ here.html
. Then requests for
+ /test/here.html/more
and
+ /test/nothere.html/more
both collect
+ /more
as PATH_INFO.
The three possible arguments for the
+
off
/test/here.html/more
in the above example will return
+ a 404 NOT FOUND error.on
/test/here.html/more
will be accepted if
+ /test/here.html
maps to a valid file.default
The primary purpose of the AcceptPathInfo
+ directive is to allow you to override the handler's choice of
+ accepting or rejecting PATH_INFO. This override is required, for
+ example, when you use a filter, such
+ as INCLUDES, to generate content
+ based on PATH_INFO. The core handler would usually reject the
+ request, so you can use the following configuration to enable
+ such a script:
When returning a document to the client the server looks for + the first existing access control file from this list of names + in every directory of the path to the document, if access + control files are enabled for that directory. For example:
+ +before returning the document
+ /usr/local/web/index.html
, the server will read
+ /.acl
, /usr/.acl
,
+ /usr/local/.acl
and /usr/local/web/.acl
+ for directives, unless they have been disabled with
This directive specifies the name of the character set that
+ will be added to any response that does not have any parameter on
+ the content type in the HTTP headers. This will override any
+ character set specified in the body of the document via a
+ META
tag. A setting of AddDefaultCharset
+ Off
disables this
+ functionality. AddDefaultCharset On
enables
+ Apache's internal default charset of iso-8859-1
as
+ required by the directive. You can also specify an alternate
+ charset to be used. For example:
The server can have modules compiled in which are not
+ actively in use. This directive can be used to enable the use
+ of those modules. The server comes with a pre-loaded list of
+ active modules; this list can be cleared with the
For example:
+When the server finds an .htaccess file (as specified by
When this directive is set to None
, then
+ .htaccess files are completely ignored. In this case, the
+ server will not even attempt to read .htaccess files in the
+ filesystem.
When this directive is set to All
, then any
+ directive which has the .htaccess Context is allowed in
+ .htaccess files.
The directive-type can be one of the following + groupings of directives.
+ +Example:
+ +This directive sets the name of the authorization realm for a
+ directory. This realm is given to the client so that the user
+ knows which username and password to send.
+
For example:
+ +The string provided for the AuthRealm
is what will
+ appear in the password dialog provided by most browsers.
This directive selects the type of user authentication for a
+ directory. Only Basic
and Digest
are
+ currently implemented.
+
+ It must be accompanied by
This directive enables the generation of
+ Content-MD5
headers as defined in RFC1864
+ respectively RFC2068.
MD5 is an algorithm for computing a "message digest" + (sometimes called "fingerprint") of arbitrary-length data, with + a high degree of confidence that any alterations in the data + will be reflected in alterations in the message digest.
+ +The Content-MD5
header provides an end-to-end
+ message integrity check (MIC) of the entity-body. A proxy or
+ client may check this header for detecting accidental
+ modification of the entity-body in transit. Example header:
Note that this can cause performance problems on your server + since the message digest is computed on every request (the + values are not cached).
+ +Content-MD5
is only sent for documents served
+ by the core, and not by any module. For example, SSI documents,
+ output from CGI scripts, and byte range responses do not have
+ this header.
There will be times when the server is asked to provide a + document whose type cannot be determined by its MIME types + mappings.
+ +The server must inform the client of the content-type of the
+ document, so in the event of an unknown type it uses the
+ DefaultType
. For example:
DefaultType image/gif
+Note that unlike
</Directory>
are used to enclose a group of
+ directives which will apply only to the named directory and
+ sub-directories of that directory. Any directive which is allowed
+ in a directory context may be used. Directory-path is
+ either the full path to a directory, or a wild-card string. In a
+ wild-card string, `?' matches any single character, and `*'
+ matches any sequences of characters. You may
+ also use `[]' character ranges like in the shell. Also as of
+ Apache 1.3 none of the wildcards match a `/' character, which more
+ closely mimics the behavior of Unix shells. Example:
Extended regular
+ expressions can also be used, with the addition of the
+ ~
character. For example:
If multiple (non-regular expression) directory sections + match the directory (or its parents) containing a document, + then the directives are applied in the order of shortest match + first, interspersed with the directives from the .htaccess files. For example, + with
+ +for access to the document /home/web/dir/doc.html
+ the steps are:
AllowOverride None
+ (disabling .htaccess
files).AllowOverride FileInfo
(for
+ directory /home/web
)./home/web/.htaccess
Regular expressions are not considered until after all of the + normal sections have been applied. Then all of the regular + expressions are tested in the order they appeared in the + configuration file. For example, with
+ +The regular expression section won't be considered until after
+ all normal <Directory>s and .htaccess
files
+ have been applied. Then the regular expression will match on
+ /home/abc/public_html/abc
and be applied.
Note that the default Apache access for + <Directory /> is Allow from All. This means + that Apache will serve any file mapped from an URL. It is + recommended that you change this with a block such + as
+ +and then override this for directories you + want accessible. See the Security Tips page for more + details.
+ +The directory sections typically occur in
+ the access.conf file, but they may appear in any configuration
+ file.
</DirectoryMatch>
are used to enclose a group
+ of directives which will apply only to the named directory and
+ sub-directories of that directory, the same as
would match directories in /www/
that consisted of three
+ numbers.
<Directory>
sThis directive sets the directory from which httpd will + serve files. Unless matched by a directive like Alias, the + server appends the path from the requested URL to the document + root to make the path to the document. Example:
+then an access to
+ http://www.my.host.com/index.html
refers to
+ /usr/web/index.html
.
The
In the event of a problem or error, Apache can be configured + to do one of four things,
+ +The first option is the default, while options 2-4 are
+ configured using the
URLs can begin with a slash (/) for local URLs, or be a full + URL which the client can resolve. Alternatively, a message can + be provided to be displayed by the browser. Examples:
+ +Note that when you specify an ErrorDocument 401
, the client will not
+ know to prompt the user for a password since it will not
+ receive the 401 status code. Therefore, if you use an
+ "ErrorDocument 401" directive then it must refer to a local
+ document.
Prior to version 2.0, messages were indicated by prefixing + them with a single unmatched double quote character.
+The
Using syslog
instead of a filename enables logging
+ via syslogd(8) if the system supports it. The default is to use
+ syslog facility local7
, but you can override this by
+ using the syslog:
facility syntax where
+ facility can be one of the names usually documented in
+ syslog(1).
SECURITY: See the security tips + document for details on why your security could be compromised + if the directory where logfiles are stored is writable by + anyone other than the user that starts the server.
+
+ The
FileETag INode MTime Size
')+ The INode, MTime, and Size keywords may be prefixed with either '+' + or '-', which allow changes to be made to the default setting + inherited from a broader scope. Any keyword appearing without + such a prefix immediately and completely cancels the inherited + setting. +
+
+ If a directory's configuration includes
+ 'FileETag INode MTime Size
', and a
+ subdirectory's includes 'FileETag -INode
',
+ the setting for that subdirectory (which will be inherited by
+ any sub-subdirectories that don't override it) will be equivalent to
+ 'FileETag MTime Size
'.
+
The </Files>
directive. The
+ directives given within this section will be applied to any object
+ with a basename (last component of filename) matching the
+ specified filename. .htaccess
files are read, but before
The filename argument should include a filename, or
+ a wild-card string, where `?' matches any single character, and
+ `*' matches any sequences of characters. Extended regular
+ expressions can also be used, with the addition of the
+ ~
character. For example:
would match most common Internet graphics formats. In Apache 1.3
+ and later,
Note that unlike
The
would match most common Internet graphics formats.
+When placed into an .htaccess
file or a
+
Note that unlike
This directive enables DNS lookups so that host names can be
+ logged (and passed to CGIs/SSIs in REMOTE_HOST
).
+ The value double
refers to doing double-reverse
+ DNS. That is, after a reverse lookup is performed, a forward
+ lookup is then performed on that result. At least one of the ip
+ addresses in the forward lookup must match the original
+ address. (In "tcpwrappers" terminology this is called
+ PARANOID
.)
Regardless of the setting, when HostnameLookups double
. For example, if only
+ HostnameLookups on
and a request is made to an object
+ that is protected by hostname restrictions, regardless of whether
+ the double-reverse fails or not, CGIs will still be passed the
+ single-reverse result in REMOTE_HOST
.
The default is off in order to save the network
+ traffic for those sites that don't truly need the reverse
+ lookups done. It is also better for the end users because they
+ don't have to suffer the extra latency that a lookup entails.
+ Heavily loaded sites should leave this directive
+ off
, since DNS lookups can take considerable
+ amounts of time. The utility logresolve, provided in
+ the /support directory, can be used to look up host
+ names from logged IP addresses offline.
This directive enables RFC1413-compliant logging of the + remote user name for each connection, where the client machine + runs identd or something similar. This information is logged in + the access log.
+ +The information should not be trusted in any way except for + rudimentary usage tracking.
+ +Note that this can cause serious latency problems accessing + your server since every request requires one of these lookups + to be performed. When firewalls are involved each lookup might + possibly fail and add 30 seconds of latency to each hit. So in + general this is not very useful on public servers accessible + from the Internet.
+The <IfDefine
+ test>...</IfDefine>
section is used to
+ mark directives that are conditional. The directives within an
+
The test in the
!
parameter-nameIn the former case, the directives between the start and end + markers are only processed if the parameter named + parameter-name is defined. The second format reverses + the test, and only processes the directives if + parameter-name is not defined.
+ +The parameter-name argument is a define as given on
+ the httpd
command line via
+ -D
parameter-, at the time the server was
+ started.
+ $ httpd -DReverseProxy ... + + # httpd.conf + <IfDefine ReverseProxy> + LoadModule rewrite_module modules/mod_rewrite.so + LoadModule proxy_module modules/libproxy.so + </IfDefine> +
The <IfModule
+ test>...</IfModule>
section is used to
+ mark directives that are conditional. The directives within an
+
The test in the
In the former case, the directives between the start and end
+ markers are only processed if the module named module
+ name is included in Apache -- either compiled in or
+ dynamically loaded using
The module name argument is the file name of the
+ module, at the time it was compiled.
+ For example, mod_rewrite.c
.
This directive allows inclusion of other configuration files + from within the server configuration files.
+ +If
The file path specified may be a fully qualified path (i.e.
+ starting with a slash), or may be relative to the
+
Examples:
+ +Or, providing paths relative to your ServerRoot
+ directory:
Make sure that an included directory does not contain any stray
+ files, such as editor temporary files, for example, as Apache will
+ attempt to read them in and use the contents as configuration
+ directives, which may cause the server to fail on start up.
+ Running apachectl configtest
will give you a list of
+ the files that are being processed during the configuration
+ check:
+ root@host# apachectl configtest + Processing config directory: /usr/local/apache/conf/vhosts + Processing config file: /usr/local/apache/conf/vhosts/vhost1 + Processing config file: /usr/local/apache/conf/vhosts/vhost2 + Syntax OK +
This will help in verifying that you are getting only the files + that you intended as part of your configuration.
+The Keep-Alive extension to HTTP/1.0 and the persistent
+ connection feature of HTTP/1.1 provide long-lived HTTP sessions
+ which allow multiple requests to be sent over the same TCP
+ connection. In some cases this has been shown to result in an
+ almost 50% speedup in latency times for HTML documents with
+ many images. To enable Keep-Alive connections in Apache 1.2 and
+ later, set KeepAlive On
.
For HTTP/1.0 clients, Keep-Alive connections will only be + used if they are specifically requested by a client. In + addition, a Keep-Alive connection with an HTTP/1.0 client can + only be used when the length of the content is known in + advance. This implies that dynamic content such as CGI output, + SSI pages, and server-generated directory listings will + generally not use Keep-Alive connections to HTTP/1.0 clients. + For HTTP/1.1 clients, persistent connections are the default + unless otherwise specified. If the client requests it, chunked + encoding will be used in order to send content of unknown + length over persistent connections.
+The number of seconds Apache will wait for a subsequent
+ request before closing the connection. Once a request has been
+ received, the timeout value specified by the
+
Setting
Access controls are normally effective for
+ all access methods, and this is the usual
+ desired behavior. In the general case, access control
+ directives should not be placed within a
+
The purpose of the <Limit>
+ bracket will have no effect. The following
+ example applies the access control only to the methods POST, PUT,
+ and DELETE, leaving all other methods unprotected:
<Limit POST PUT DELETE>
+ Require valid-user
+ </Limit>
+The method names listed can be one or more of: GET, POST, PUT, + DELETE, CONNECT, OPTIONS, TRACE, PATCH, PROPFIND, PROPPATCH, + MKCOL, COPY, MOVE, LOCK, and UNLOCK. The method name is + case-sensitive. If GET is used it will also restrict + HEAD requests.
+</LimitExcept>
are used to enclose a group of
+ access control directives which will then apply to any HTTP access
+ method not listed in the arguments; i.e., it is
+ the opposite of a
This directive specifies the number of bytes from 0
+ (meaning unlimited) to 2147483647 (2GB) that are allowed in a
+ request body. The default value is defined by the compile-time
+ constant DEFAULT_LIMIT_REQUEST_BODY
(0 as
+ distributed).
The
This directive gives the server administrator greater + control over abnormal client request behavior, which may be + useful for avoiding some forms of denial-of-service + attacks.
+Number is an integer from 0 (meaning unlimited) to
+ 32767. The default value is defined by the compile-time
+ constant DEFAULT_LIMIT_REQUEST_FIELDS
(100 as
+ distributed).
The
This directive gives the server administrator greater + control over abnormal client request behavior, which may be + useful for avoiding some forms of denial-of-service attacks. + The value should be increased if normal clients see an error + response from the server that indicates too many fields were + sent in the request.
+This directive specifies the number of bytes from 0
+ to the value of the compile-time constant
+ DEFAULT_LIMIT_REQUEST_FIELDSIZE
(8190 as
+ distributed) that will be allowed in an HTTP request
+ header.
The
This directive gives the server administrator greater + control over abnormal client request behavior, which may be + useful for avoiding some forms of denial-of-service attacks. + Under normal conditions, the value should not be changed from + the default.
+This directive sets the number of bytes from 0 to
+ the value of the compile-time constant
+ DEFAULT_LIMIT_REQUEST_LINE
(8190 as distributed)
+ that will be allowed on the HTTP request-line.
The
This directive gives the server administrator greater + control over abnormal client request behavior, which may be + useful for avoiding some forms of denial-of-service attacks. + Under normal conditions, the value should not be changed from + the default.
+Limit (in bytes) on maximum size of an XML-based request
+ body. A value of 0
will disable any checking.
The </Location>
directive. .htaccess
files are read, and after the
Note that URLs do not have to line up with the filesystem at + all, it should be emphasized that <Location> operates + completely outside the filesystem.
+ +For all origin (non-proxy) requests, the URL to be matched
+ is of the form /path/
, and you should not include
+ any http://servername
prefix. For proxy requests,
+ the URL to be matched is of the form
+ scheme://servername/path
, and you must include the
+ prefix.
The URL may use wildcards In a wild-card string, `?' matches + any single character, and `*' matches any sequences of + characters.
+ +Extended regular
+ expressions can also be used, with the addition of the
+ ~
character. For example:
would match URLs that contained the substring "/extra/data" or
+ "/special/data". In Apache 1.3 and above, a new directive
+
The
The slash character has
+special meaning depending on where in a URL it appears. People may be
+used to its behavior in the filesystem where multiple adjacent slashes
+are frequently collapsed to a single slash (i.e.,
+/home///foo
is the same as /home/foo
). In
+URL-space this is not necessarily true. The <LocationMatch ^/abc>
would match the
+request URL /abc
but not the request URL
+//abc
. The (non-regex) <Location /abc/def>
and the
+request is to /abc//def
then it will match.
The
would match URLs that contained the substring "/extra/data" + or "/special/data".
+Level | + +Description | +
---|---|
+ | + +Example | +
emerg |
+
+ Emergencies - system is unusable. | +
+ | + +"Child cannot open lock file. Exiting" | +
alert |
+
+ Action must be taken immediately. | +
+ | + +"getpwuid: couldn't determine user name from uid" | +
crit |
+
+ Critical Conditions. | +
+ | + +"socket: Failed to get a socket, exiting child" | +
error |
+
+ Error conditions. | +
+ | + +"Premature end of script headers" | +
warn |
+
+ Warning conditions. | +
+ | + +"child process 1234 did not exit, sending another + SIGHUP" | +
notice |
+
+ Normal but significant condition. | +
+ | + +"httpd: caught SIGBUS, attempting to dump core in + ..." | +
info |
+
+ Informational. | +
+ | + +"Server seems busy, (you may need to increase + StartServers, or Min/MaxSpareServers)..." | +
debug |
+
+ Debug-level messages | +
+ | + +"Opening config file ..." | +
When a particular level is specified, messages from all
+ other levels of higher significance will be reported as well.
+ E.g., when LogLevel info
is specified,
+ then messages with log levels of notice
and
+ warn
will also be posted.
Using a level of at least crit
is
+ recommended.
The 0
", unlimited requests will be allowed. We
+ recommend that this setting be kept to a high value for maximum
+ server performance.
The
Although addr can be hostname it is recommended + that you always use an IP address, e.g.
+ +With the
Note: the "main server" and any _default_ servers will
+ never be served for a request to a
+
Optionally you can specify a port number on which the + name-based virtual hosts should be used, e.g.
+ +IPv6 addresses must be enclosed in square brackets, as shown + in the following example:
+ +The
option can be set to None
, in which
+ case none of the extra features are enabled, or one or more of
+ the following:
Normally, if multiple
For example, without any + and - symbols:
+ + +then only Includes
will be set for the
+ /web/docs/spec directory. However if the second
+
then the options FollowSymLinks
and
+ Includes
are set for the /web/docs/spec directory.
Note: Using -IncludesNOEXEC
or
+ -Includes
disables server-side includes completely
+ regardless of the previous setting.
The default in the absence of any other settings is
+ All
.
This directive selects which authenticated users can access + a directory. The allowed syntaxes are:
+ +Only the named users can access the directory.
+Only users in the named groups can access the + directory.
+All valid users can access the directory.
+Access controls which are applied in this way are effective for
+ all methods. This is what is normally
+ desired. If you wish to apply access controls only to
+ specific methods, while leaving other methods unprotected, then
+ place the
Takes 1 or 2 parameters. The first parameter sets the soft + resource limit for all processes and the second parameter sets + the maximum resource limit. Either parameter can be a number, + or max to indicate to the server that the limit should + be set to the maximum allowed by the operating system + configuration. Raising the maximum resource limit requires that + the server is running as root, or in the initial startup + phase.
+ +This applies to processes forked off from Apache children + servicing requests, not the Apache children themselves. This + includes CGI scripts and SSI exec commands, but not any + processes forked off from the Apache parent such as piped + logs.
+ +CPU resource limits are expressed in seconds per + process.
+Takes 1 or 2 parameters. The first parameter sets the soft + resource limit for all processes and the second parameter sets + the maximum resource limit. Either parameter can be a number, + or max to indicate to the server that the limit should + be set to the maximum allowed by the operating system + configuration. Raising the maximum resource limit requires that + the server is running as root, or in the initial startup + phase.
+ +This applies to processes forked off from Apache children + servicing requests, not the Apache children themselves. This + includes CGI scripts and SSI exec commands, but not any + processes forked off from the Apache parent such as piped + logs.
+ +Memory resource limits are expressed in bytes per + process.
+Takes 1 or 2 parameters. The first parameter sets the soft
+ resource limit for all processes and the second parameter sets
+ the maximum resource limit. Either parameter can be a number,
+ or max
to indicate to the server that the limit
+ should be set to the maximum allowed by the operating system
+ configuration. Raising the maximum resource limit requires that
+ the server is running as root, or in the initial startup
+ phase.
This applies to processes forked off from Apache children + servicing requests, not the Apache children themselves. This + includes CGI scripts and SSI exec commands, but not any + processes forked off from the Apache parent such as piped + logs.
+ +Process limits control the number of processes per user.
+ +Note: If CGI processes are not running + under userids other than the web server userid, this directive + will limit the number of processes that the server itself can + create. Evidence of this situation will be indicated by + cannot fork messages in the + error_log.
+Access policy if both
This directive is used to control how Apache finds the
+ interpreter used to run CGI scripts. The default technique is to
+ use the interpreter pointed to by the #! line in the
+ script. Setting ScriptInterpreterSource registry
will
+ cause the Windows Registry to be searched using the script file
+ extension (e.g., .pl) as a search key.
The
It may be worth setting up a dedicated address for this, + e.g.
+as users do not always mention that they are talking about the + server!
+The
The simple.example.com
,
+ but the machine also has the DNS alias www.example.com
+ and you wish the webserver to be so identified, the following
+ directive should be used:
If no
If you are using name-based virtual hosts,
+ the Host:
header to match this virtual host.
See the description of the
+
The
The conf/
and logs/
. Relative
+ paths for other configuration files are taken as relative to this
+ directory.
-d
+ option to httpd
The
The Off
+ setting, which is the default, suppresses the error line (and is
+ therefore compatible with the behavior of Apache-1.2 and
+ below). The On setting simply adds a line with the
+ server version number and
This directive controls whether Server response + header field which is sent back to clients includes a + description of the generic OS-type of the server as well as + information about compiled-in modules.
+ +ServerTokens Prod[uctOnly]
ServerTokens Min[imal]
ServerTokens OS
ServerTokens Full
(or not specified)This setting applies to the entire server, and cannot be + enabled or disabled on a virtualhost-by-virtualhost basis.
+When placed into an .htaccess
file or a
+ .htaccess
file in that directory:
Another example: if you wanted to have the server display a
+ status report whenever a URL of
+ http://servername/status
was called, you might put
+ the following into httpd.conf:
The
If more than one filter is specified, they must be separated + by semicolons in the order in which they should process the + content.
+The
For example, the following configuration will process all files
+ in the /www/data/
directory for server-side
+ includes.
If more than one filter is specified, they must be separated + by semicolons in the order in which they should process the + content.
+The
We plan on making these separately configurable at some point + down the road. The timer used to default to 1200 before 1.2, + but has been lowered to 300 which is still far more than + necessary in most situations. It is not set any lower by + default because there may still be odd places in the code where + the timer is not reset when a packet is sent.
+In many situations Apache has to construct a
+ self-referential URL. That is, a URL which refers back to
+ the same server. With UseCanonicalName on
Apache will
+ use the hostname and port specified in the SERVER_NAME
and
+ SERVER_PORT
in CGIs.
With UseCanonicalName off
Apache will form
+ self-referential URLs using the hostname and port supplied by
+ the client if any are supplied (otherwise it will use the
+ canonical name). These values are the same that are used to
+ implement name based
+ virtual hosts, and are available with the same clients. The
+ CGI variables SERVER_NAME
and
+ SERVER_PORT
will be constructed from the client
+ supplied values as well.
An example where this may be useful is on an intranet server
+ where you have users connecting to the machine using short
+ names such as www
. You'll notice that if the users
+ type a shortname, and a URL which is a directory, such as
+ http://www/splat
, without the trailing
+ slash then Apache will redirect them to
+ http://www.domain.com/splat/
. If you have
+ authentication enabled, this will cause the user to have to
+ reauthenticate twice (once for www
and once again
+ for www.domain.com
). But if
+ http://www/splat/
.
There is a third option, UseCanonicalName DNS
,
+ which is intended for use with mass IP-based virtual hosting to
+ support ancient clients that do not provide a
+ Host:
header. With this option Apache does a
+ reverse DNS lookup on the server IP address that the client
+ connected to in order to work out self-referential URLs.
Warning: if CGIs make assumptions about the
+ values of SERVER_NAME
they may be broken by this
+ option. The client is essentially free to give whatever value
+ they want as a hostname. But if the CGI is only using
+ SERVER_NAME
to construct self-referential URLs
+ then it should be just fine.
</VirtualHost>
are used to enclose a group of
+ directives which will apply only to a particular virtual host. Any
+ directive which is allowed in a virtual host context may be
+ used. When the server receives a request for a document on a
+ particular virtual host, it uses the configuration directives
+ enclosed in the
IPv6 addresses must be specified in square brackets because + the optional port number could not be determined otherwise. An + IPv6 example is shown below:
+ +Each Virtual Host must correspond to a different IP address,
+ different port number or a different host name for the server,
+ in the former case the server machine must be configured to
+ accept IP packets for multiple addresses. (If the machine does
+ not have multiple network interfaces, then this can be
+ accomplished with the ifconfig alias
command (if
+ your OS supports it), or with kernel patches like VIF (for SunOS(TM) 4.1.x)).
The special name _default_
can be specified in
+ which case this virtual host will match any IP address that is
+ not explicitly listed in another virtual host. In the absence
+ of any _default_ virtual host the "main" server config,
+ consisting of all those definitions outside any VirtualHost
+ section, is used when no match occurs.
You can specify a :port
to change the port that is
+ matched. If unspecified then it defaults to the same port as the
+ most recent :*
+ to match all ports on that address. (This is recommended when used
+ with _default_
.)
SECURITY: See the security tips document + for details on why your security could be compromised if the + directory where logfiles are stored is writable by anyone other + than the user that starts the server.
+ +NOTE: The use of
Each Apache directive available in the standard Apache + distribution is listed here. They are described using a + consistent format, and there is a dictionary of the terms used in their + descriptions available.
+Below is a list of all of the modules that come as part of + the Apache distribution. See also the complete + alphabetical list of all Apache + directives.
+ +This module has two directives. The
This directive adds an action, which will activate + cgi-script when action-type is triggered by + the request. The action-type can be either a handler or a MIME content type. It + sends the URL and file path of the requested document using the + standard CGI PATH_INFO and PATH_TRANSLATED environment + variables.
+ +In the first example, requests for files with a MIME content
+ type of image/gif
will instead be handled by the
+ specified cgi script /cgi-bin/images.cgi
.
In the second example, requests for files with a file extension of
+ .xyz
are handled instead by the specified cgi script
+ /cgi-bin/program.cgi
.
This directive adds an action, which will activate + cgi-script when a file is requested using the method of + method. It sends the URL and file path of the requested + document using the standard CGI PATH_INFO and PATH_TRANSLATED + environment variables.
+ +Script PUT
and
+ Script put
have two entirely different
+ effects.
+Note that the Script command defines default actions only.
+ If a CGI script is called, or some other resource that is
+ capable of handling the requested method internally, it will do
+ so. Also note that Script with a method of GET
+ will only be called if there are query arguments present
+ (e.g., foo.html?hi). Otherwise, the request will
+ proceed normally.
The directives contained in this module allow for manipulation
+ and control of URLs as requests arrive at the server. The
+
The
A more powerful and flexible set of directives for
+ manipulating URLs is contained in the
The
Example:
+ +A request for http://myserver/image/foo.gif would cause the + server to return the file /ftp/pub/image/foo.gif.
+ +Note that if you include a trailing / on the
+ url-path then the server will require a trailing / in
+ order to expand the alias. That is, if you use Alias
+ /icons/ /usr/local/apache/icons/
then the url
+ /icons
will not be aliased.
Note that you may need to specify additional
This directive is equivalent to /icons
directory, one might
+ use:
The Redirect directive maps an old URL into a new one. The + new URL is returned to the client which attempts to fetch it + again with the new address. URL-path a (%-decoded) + path; any requests for documents beginning with this path will + be returned a redirect error to a new (%-encoded) URL beginning + with URL.
+ +Example:
+ +If the client requests http://myserver/service/foo.txt, it + will be told to access http://foo2.bar.com/service/foo.txt + instead.
+ +Redirect directives take precedence over
+Alias and ScriptAlias directives, irrespective of their ordering in
+the configuration file. Also, URL-path must be an absolute
+path, not a relative path, even when used with .htaccess files or
+inside of
If no status argument is given, the redirect will + be "temporary" (HTTP status 302). This indicates to the client + that the resource has moved temporarily. The status + argument can be used to return other HTTP status codes:
+ +Other status codes can be returned by giving the numeric
+ status code as the value of status. If the status is
+ between 300 and 399, the url argument must be present,
+ otherwise it must be omitted. Note that the status must be
+ known to the Apache code (see the function
+ send_error_response
in http_protocol.c).
This directive is equivalent to
This directive makes the client know that the Redirect is
+ only temporary (status 302). Exactly equivalent to
+ Redirect temp
.
This directive makes the client know that the Redirect is
+ permanent (status 301). Exactly equivalent to Redirect
+ permanent
.
The
Example:
+ +A request for http://myserver/cgi-bin/foo
would cause the
+ server to run the script /web/cgi-bin/foo
.
This directive is equivalent to /cgi-bin
, one
+ might use:
This module provides the handler send-as-is
+ which causes Apache to send the document without adding most of
+ the usual HTTP headers.
This can be used to send any kind of data from the server, + including redirects and other special HTTP responses, without + requiring a cgi-script or an nph script.
+ +For historical reasons, this module will also process any
+ file with the mime type httpd/send-as-is
.
In the server configuration file, associate files with the
+ send-as-is
handler e.g.
The contents of any file with a .asis
extension
+ will then be sent by Apache to the client with almost no
+ changes. Clients will need HTTP headers to be attached, so do
+ not forget them. A Status: header is also required; the data
+ should be the 3-digit HTTP response code, followed by a textual
+ message.
Here's an example of a file whose contents are sent as + is so as to tell the client that a file has + redirected.
+ + +Notes: the server always adds a Date: and Server: header to + the data returned to the client, so these should not be + included in the file. The server does not add a + Last-Modified header; it probably should.
+This module implements HTTP Digest Authentication. However, it + has not been extensively tested and is therefore marked + experimental.
+Using MD5 Digest authentication is very simple. Simply set + up authentication normally, using "AuthType Digest" and + "AuthDigestFile" instead of the normal "AuthType Basic" and + "AuthUserFile"; also, replace any "AuthGroupFile" with + "AuthDigestGroupFile". Then add a "AuthDigestDomain" directive + containing at least the root URI(s) for this protection space. + Example:
+MD5 authentication provides a more + secure password system than Basic authentication, but only + works with supporting browsers. As of this writing (October 2001), + the only major browsers which support digest authentication are + Opera 4.0, + MS Internet + Explorer 5.0 and Amaya. + Therefore, we do not yet recommend using this feature on a large + Internet site. However, for personal and intra-net use, where + browser users can be controlled, it is ideal.
+The
The digest file uses a special format. Files in this format + can be created using the htdigest utility found in + the support/ subdirectory of the Apache distribution.
+The
Each line of the group file contains a groupname followed by + a colon, followed by the member usernames separated by spaces. + Example:
+ +Note that searching large text files is very + inefficient.
+ +Security: make sure that the AuthGroupFile is stored outside + the document tree of the web-server; do not put it in + the directory that it protects. Otherwise, clients will be able + to download the AuthGroupFile.
+The
auth-int is not implemented + yet.
+The stale=true
. If seconds is
+ greater than 0 then it specifies the amount of time for which the
+ nonce is valid; this should probably never be set to less than 10
+ seconds. If seconds is less than 0 then the nonce never
+ expires.
+
Not implemented yet. +
+Not implemented yet. +
+The
MD5-sess is not correctly implemented + yet. +
+The
This directive should always be specified and + contain at least the (set of) root URI(s) for this space. + Omitting to do so will cause the client to send the + Authorization header for every request sent to this + server. Apart from increasing the size of the request, it may + also have a detrimental effect on performance if + "AuthDigestNcCheck" is on.
+ +The URIs specified can also point to different servers, in + which case clients (which understand this) will then share + username/password info across multiple servers without + prompting the user each time.
+The index of a directory can come from one of two + sources:
+ +index.html
. The The two functions are separated so that you can completely + remove (or replace) automatic index generation should you want + to.
+ +Automatic index generation is enabled with using
+ Options +Indexes
. See the
+
If the
Note that when the display is sorted by "Size", it's the + actual size of the files that's used, not the + displayed value - so a 1010-byte file will always be displayed + before a 1011-byte file (if in ascending order) even though + they both are shown as "1K".
+Apache 2.0.23 reorganized the Query Arguments for Column
+ Sorting, and introduced an entire group of new query options.
+ To effectively eliminate all client control over the output,
+ the IndexOptions
+ IgnoreClient
option was introduced.
The column sorting headers themselves are self-referencing + hyperlinks that add the sort query options shown below. Any + option below may be added to any request for the directory + resource.
+ +Note that the 'P'attern query argument is tested + after the usual IndexIgnore directives are processed, + and all file names are still subjected to the same criteria as + any other autoindex listing. The Query Arguments parser in + mod_autoindex will stop abruptly when an unrecognized option is + encountered. The Query Arguments must be well formed, according + to the table above.
+ +The simple example below, which can be clipped and saved in + a header.html file, illustrates these query options. Note that + the unknown "X" argument, for the submit button, is listed last + to assure the arguments are all parsed before mod_autoindex + encounters the X=Go input.
+ +FancyIndexing
.
+ File is a file extension, partial filename, wild-card
+ expression or full filename for files to describe.
+ String is enclosed in double quotes ("
).
+ This alternate text is displayed if the client is image-incapable,
+ has image loading disabled, or fails to retrieve the icon.
Examples:
+FancyIndexing
.
+ MIME-encoding is a valid content-encoding, such as
+ x-compress
. String is enclosed in double
+ quotes ("
). This alternate text is displayed if the
+ client is image-incapable, has image loading disabled, or fails to
+ retrieve the icon.
Example:
+FancyIndexing
.
+ MIME-type is a valid content-type, such as
+ text/html
. String is enclosed in double
+ quotes ("
). This alternate text is displayed if the
+ client is image-incapable, has image loading disabled, or fails to
+ retrieve the icon.
Example:
+This sets the description to display for a file, for
+ FancyIndexing
.
+ File is a file extension, partial filename, wild-card
+ expression or full filename for files to describe.
+ String is enclosed in double quotes ("
).
+ Example:
The typical, default description field is 23 bytes wide. 6
+ more bytes are added by the
+ IndexOptions SuppressIcon
option, 7 bytes are
+ added by the IndexOptions SuppressSize
+ option, and 19 bytes are added by the
+ IndexOptions SuppressLastModified
option.
+ Therefore, the widest default the description column is ever
+ assigned is 55 bytes.
See the DescriptionWidth
+
Descriptive text defined with
+
This sets the icon to display next to a file ending in
+ name for FancyIndexing
.
+ Icon is either a (%-escaped) relative URL to the icon,
+ or of the format (alttext,url) where
+ alttext is the text tag given for an icon for
+ non-graphical browsers.
Name is either ^^DIRECTORY^^ for directories, + ^^BLANKICON^^ for blank lines (to format the list correctly), a + file extension, a wildcard expression, a partial filename or a + complete filename. Examples:
+ +This sets the icon to display next to files with FancyIndexing
.
+ Icon is either a (%-escaped) relative URL to the icon,
+ or of the format (alttext,url) where
+ alttext is the text tag given for an icon for
+ non-graphical browsers.
Mime-encoding is a wildcard expression matching + required the content-encoding. Examples:
+ +This sets the icon to display next to files of type
+ MIME-type for FancyIndexing
.
+ Icon is either a (%-escaped) relative URL to the icon,
+ or of the format (alttext,url) where
+ alttext is the text tag given for an icon for
+ non-graphical browsers.
Mime-type is a wildcard expression matching + required the mime types. Examples:
+ +The FancyIndexing
.
+ Url is a (%-escaped) relative URL to the icon.
+ Examples:
The
Both HeaderName and text/*
" (e.g., text/html
,
+ text/plain
, etc.). This means that
+ filename may refer to a CGI script if the script's
+ actual file type (as opposed to its output) is marked as
+ text/html
such as with a directive like:
Content negotiation
+ will be performed if the MultiViews
text/html
+ document (not a CGI script) and the Includes
+
If the file specified by IndexOptions
+ +SuppressHTMLPreamble
, so that these tags are not
+ repeated.
The .
'. Example:
The
DescriptionWidth
keyword allows you to
+ specify the width of the description column in
+ characters.-DescriptionWidth
(or unset) allows
+ mod_autoindex to calculate the best width.DescriptionWidth=n
fixes the column width to
+ n bytes wide.DescriptionWidth=*
grows the column to the
+ width necessary to accommodate the longest description
+ string.FoldersFirst
is enabled, subdirectory
+ Zed
will be listed before subdirectory
+ Beta
, which will be listed before normal files
+ Gamma
and Alpha
. This option
+ only has an effect if FancyIndexing
+ is also enabled.HEIGHT
and
+ WIDTH
attributes in the IMG
tag for
+ the file icon. This allows browser to precalculate the page
+ layout without having to wait until all the images have been
+ loaded. If no value is given for the option, it defaults to
+ the standard height of the icons supplied with the Apache
+ software.HEIGHT
and
+ WIDTH
attributes in the IMG
tag for
+ the file icon. This allows browser to precalculate the page
+ layout without having to wait until all the images have been
+ loaded. If no value is given for the option, it defaults to
+ the standard width of the icons supplied with the Apache
+ software.SuppressColumnSorting
.)-NameWidth
(or unset) allows mod_autoindex
+ to calculate the best width.NameWidth=n
fixes the column width to n
+ bytes wide.NameWidth=*
grows the column to the
+ necessary width.AddDescription
for
+ information about setting the file description. See also the
+ DescriptionWidth
+ index option to limit the size of the description
+ column.IndexOptions FancyIndexing ScanHTMLTitles
.IndexOptions FancyIndexing +SuppressSize
,
+ because the unprefixed FancyIndexing
discarded
+ the incremental keywords before it, but allowed them to
+ start accumulating again afterward.The FancyIndexing
+ index option. By default, fancyindexed directory listings are
+ displayed in ascending order by filename; the
+
Ascending
or
+ Descending
, indicating the direction of the sort.
+ The second argument must be one of the keywords Name
,
+ Date
, Size
, or Description
,
+ and identifies the primary key. The secondary key is
+ always the ascending filename.
You can force a directory listing to only be displayed in a
+ particular order by combining this directive with the SuppressColumnSorting
+ index option; this will prevent the client from requesting the
+ directory listing in a different order.
The
See also
Emulate the CERN HTTPD Meta file semantics. Meta files are HTTP + headers that can be output in addition to the normal range of + headers for each file accessed. They appear rather like the + Apache .asis files, and are able to provide a crude way of + influencing the Expires: header, as well as providing other + curiosities. There are many ways to manage meta information, + this one was chosen because there is already a large number of + CERN users who can exploit this module.
+ +More information on the + CERN metafile semantics is available.
+Turns on/off Meta file processing on a per-directory basis.
+Specifies the name of the directory in which Apache can find
+ meta information files. The directory is usually a 'hidden'
+ subdirectory of the directory that contains the file being
+ accessed. Set to ".
" to look in the same directory
+ as the file.
Specifies the file name suffix for the file containing the
+ meta information. For example, the default values for the two
+ directives will cause a request to
+ DOCUMENT_ROOT/somedir/index.html
to look in
+ DOCUMENT_ROOT/somedir/.web/index.html.meta
and
+ will use its contents to generate additional MIME header
+ information.
Any file that has the mime type
+ application/x-httpd-cgi
or handler
+ cgi-script
(Apache 1.1 or later) will be treated
+ as a CGI script, and run by the server, with its output being
+ returned to the client. Files acquire this type either by
+ having a name containing an extension defined by the
+
When the server invokes a CGI script, it will add a variable
+ called DOCUMENT_ROOT
to the environment. This
+ variable will contain the value of the
+
For an introduction to using CGI scripts with Apache, see + our tutorial on Dynamic Content + With CGI.
+ +When using a multi-threaded MPM under unix, the module
+
The server will set the CGI environment variables as described + in the CGI + specification, with the following provisions:
+ +off
. The default behavior, if AcceptPathInfo is
+ not given, is that mod_cgi will accept path info (trailing
+ /more/path/info following the script filename in the URI), while
+ the core server will return a 404 NOT FOUND error for requests
+ with additional path info. Omitting the AcceptPathInfo
+ directive has the same effect as setting it on
for
+ mod_cgi requests.on
(it
+ is off by default), and if a reverse DNS lookup of the accessing
+ host's address indeed finds a host name.on
and the accessing host supports the ident
+ protocol. Note that the contents of this variable cannot be
+ relied upon because it can easily be faked, and if there is a
+ proxy between the client and the server, it is usually
+ totally useless.Debugging CGI scripts has traditionally been difficult, mainly + because it has not been possible to study the output (standard + output and error) for scripts which are failing to run + properly. These directives, included in Apache 1.2 and later, + provide more detailed logging of errors when they occur.
+ +When configured, the CGI error log logs any CGI which does not + execute properly. Each CGI script which fails to operate causes + several lines of information to be logged. The first two lines + are always of the format:
+If the error is that CGI script cannot be run, the log file + will contain an extra two lines:
+Alternatively, if the error is the result of the script + returning incorrect header information (often due to a bug in + the script), the following information is logged:
+(The %stdout and %stderr parts may be missing if the script did + not output anything on standard output or standard error).
+The
This log will be opened as the user the child processes run
+ as, ie. the user specified in the main
Note that script logging is meant to be a debugging feature + when writing CGI scripts, and is not meant to be activated + continuously on running servers. It is not optimized for speed + or efficiency, and may have security problems if used in a + manner other than that for which it was designed.
+The size of any PUT or POST entity body that is logged to + the file is limited, to prevent the log file growing too big + too quickly if large bodies are being received. By default, up + to 1024 bytes are logged, but this can be changed with this + directive.
+Except for the optimizations and the additional
On certain unix operating systems, forking a process from a + multi-threaded server is a very expensive operation because the + new process will replicate all the threads of the parent + process. In order to avoid incurring this expense on each CGI + invocation, mod_cgid creates an external daemon that is + responsible for forking child processes to run CGI scripts. The + main server communicates with this daemon using a unix domain + socket.
+ +This module is used by default whenever a multi-threaded MPM
+ is selected during the compilation process. At the user level,
+ this module is identical in configuration and operation to
+ ScriptSock
which gives the
+ name of the socket to use for communication with the cgi
+ daemon.
This directive sets the name of the socket to use for + communication with the CGI daemon. The socket will be opened + using the permissions of the user who starts Apache (usually + root). To maintain the security of communications with CGI + scripts, it is important that no other user has permission to + write in the directory where the socket is located.
+This is an experimental module and should
+ be used with care. Experiment with your
+ mod_charset_lite
configuration to ensure that it
+ performs the desired function.
This module provides a small subset of configuration
+ mechanisms implemented by Russian Apache and its associated
+ mod_charset
.
The character set name parameters of
If the translation rules don't make sense for the content, + translation can fail in various ways, including:
+ +The
The value of the charset argument must be accepted + as a valid character set name by the character set support in + APR. Generally, this means that it must be supported by + iconv.
+ Example: +The character set names in this example work with the iconv + translation support in Solaris 8.
+The
The value of the charset argument must be accepted + as a valid character set name by the character set support in + APR. Generally, this means that it must be supported by + iconv.
+ Example: +The
DebugLevel
keyword allows you to specify
+ the level of debug messages generated by
+ DebugLevel=0
.
+ With higher numbers, more debug messages are generated, and
+ server performance will be degraded. The actual meanings of
+ the numeric values are described with the definitions of the
+ DBGLVL_ constants near the beginning of
+ mod_charset_lite.c
.ImplicitAdd
keyword specifies that
+ NoImplicitAdd
should be specified so that
+ This module provides class 1 and class 2 WebDAV ('Web-based Distributed + Authoring and Versioning') functionality for Apache. This + extension to the HTTP protocol allows creating, moving, + copying, and deleting resources and collections on a remote web + server.
+ +To enable mod_dav, add the following to a container in your
+ httpd.conf
file:
Also, specify a valid filename for the DAV lock database by
+ adding the following to the global section in your
+ httpd.conf
file:
Use the
Use the modules/dav/util/lockview
can be used from the server
+ to display all locks in a lock database.
When a client requests a DAV resource lock, it can also + specify a time when the lock will be automatically removed by + the server. This value is only a request, and the server can + ignore it or inform the client of an arbitrary value.
+ +Use the
Use the
This module provides the ability to set environment + variables based upon attributes of the request.
+ +Status: Experimental
+ Source File:
+ mod_deflate.c
+ Module Identifier:
+ deflate_module
+ Compatibility: Available in
+ Apache 2.0 and later.
The experimental mod_deflate module allows + output from your server to be compressed before being sent + to the client over the network.
+ +Syntax: DeflateFilterNote notename
+
+ Default: none
+ Context: server config
+ Override: none
+ Status: Experimental
+ Module: mod_deflate
+ Compatibility: Apache 2.0 and
+ above
The DeflateFilterNote directive specifies that a note about + compression ratios should be attached to the request. The name + of the note is the value specified for the directive.
+ +Syntax: DeflateWindowSize
+ value
+ Default: none
+ Context: server config
+ Override: none
+ Status: Experimental
+ Module: mod_deflate
+ Compatibility: Apache 2.0 and
+ above
The DeflateWindowSize directive specifies the + zlib compression window size.
+ +Syntax: DeflateMemLevel
+ value
+ Default: none
+ Context: server config
+ Override: none
+ Status: Experimental
+ Module: mod_deflate
+ Compatibility: Apache 2.0 and
+ above
The DeflateMemLevel directive specifies the amount of + memory available to zlib for compression.
+ + + + diff --git a/docs/manual/mod/mod_deflate.xml b/docs/manual/mod/mod_deflate.xml new file mode 100644 index 00000000000..44b5efda36f --- /dev/null +++ b/docs/manual/mod/mod_deflate.xml @@ -0,0 +1,88 @@ + + ]> + +The experimental DEFLATE
output filter that allows output from
+ your server to be compressed before being sent to the client over
+ the network.
Compression is implemented by the DEFLATE
+ filter. The following directive
+ will enable compression for documents in the container where it
+ is placed:
Most popular browsers can not handle compression of all content + so you may want to enable the 'gzip-only-text/html' note (see below) +
+ +Here is an example of enabling compression for the Apache + documentation:
+ +The
The
The
The index of a directory can come from one of two sources:
+ +index.html
. The The two functions are separated so that you can completely + remove (or replace) automatic index generation should you want + to.
+ +A "trailing slash" redirect is issued when the server
+ receives a request for a URL
+ http://servername/foo/dirname
where
+ dirname
is a directory. Directories require a
+ trailing slash, so http://servername/foo/dirname/
.
The Indexes
option is
+ set, the server will generate its own listing of the
+ directory.
then a request for http://myserver/docs/
would
+ return http://myserver/docs/index.html
if it
+ exists, or would list the directory if it did not.
Note that the documents do not need to be relative to the + directory;
+ +would cause the CGI script /cgi-bin/index.pl
to be
+ executed if neither index.html
or
+ index.txt
existed in a directory.
This module allows for control of the environment that will + be provided to CGI scripts and SSI pages. Environment variables + may be passed from the shell which invoked the httpd process. + Alternatively, environment variables may be set or unset within + the configuration process.
+Specifies one or more environment variables to pass to CGI + scripts and SSI pages from the environment of the shell which + invoked the httpd process. Example:
+Sets an environment variable, which is then passed on to CGI + scripts and SSI pages. Example:
+Removes one or more environment variables from those passed + on to CGI scripts and SSI pages. Example:
+The files in the src/modules/example directory
+ under the Apache distribution directory tree are provided as an
+ example to those that wish to write modules that use the Apache
+ API.
The main file is mod_example.c
, which
+ illustrates all the different callback mechanisms and call
+ syntaxes. By no means does an add-on module need to include
+ routines for all of the callbacks - quite the contrary!
The example module is an actual working module. If you link + it into your server, enable the "example-handler" handler for a + location, and then browse to that location, you will see a + display of some of the tracing the example module did as the + various callbacks were made.
+To include the example module in your server, follow the + steps below:
+ +src/Configuration
file.
+ If there isn't one, add it; it should look like this:
+src/Configure
script
+ ("cd src; ./Configure
"). This will
+ build the Makefile for the server itself, and update the
+ src/modules/Makefile
for any additional modules
+ you have requested from beneath that subdirectory.make
" in the
+ src
directory).To add another module of your own:
+ +mkdir src/modules/mymodule
cp src/modules/example/*
+ src/modules/mymodule
mod_example
ModuleTo activate the example module, include a block similar to
+ the following in your srm.conf
file:
As an alternative, you can put the following into a .htaccess
file
+ and then request the file "test.example" from that location:
After reloading/restarting your server, you should be able + to browse to this location and see the brief display mentioned + earlier.
+The Example
+ directive declared here: YES/NO
".
Expires
HTTP headers according to user-specified
+ criteriaThis module controls the setting of the Expires
+ HTTP header in server responses. The expiration date can set to
+ be relative to either the time the source file was last
+ modified, or to the time of the client access.
The Expires
HTTP header is an instruction to
+ the client about the document's validity and persistence. If
+ cached, the document may be fetched from the cache rather than
+ from the source until this time has passed. After that, the
+ cache copy is considered "expired" and invalid, and a new copy
+ must be obtained from the source.
The
where <base> is one of:
+ +access
now
(equivalent to
+ 'access
')modification
The 'plus
' keyword is optional. <num>
+ should be an integer value [acceptable to atoi()
],
+ and <type> is one of:
years
months
weeks
days
hours
minutes
seconds
For example, any of the following directives can be used to + make documents expire 1 month after being accessed, by + default:
+ +The expiry time can be fine-tuned by adding several + '<num> <type>' clauses:
+ +Note that if you use a modification date based setting, the + Expires header will not be added to content + that does not come from a file on disk. This is due to the fact + that there is no modification time for such content.
+Expires
headersThis directive enables or disables the generation of the
+ Expires
header for the document realm in question.
+ (That is, if found in an .htaccess
file, for
+ instance, it applies only to documents generated from that
+ directory.) If set to Off
, no
+ Expires
header will be generated for any document
+ in the realm (unless overridden at a lower level, such as an
+ .htaccess
file overriding a server config file).
+ If set to On
, the header will be added to
+ served documents according to the criteria defined by the
+
Note that this directive does not guarantee that an
+ Expires
header will be generated. If the criteria
+ aren't met, no header will be sent, and the effect will be as
+ though this directive wasn't even specified.
Expires
header configured
+by MIME typeThis directive defines the value of the Expires
+ header generated for documents of the specified type
+ (e.g., text/html
). The second argument
+ sets the number of seconds that will be added to a base time to
+ construct the expiration date.
The base time is either the last modification time of the
+ file, or the time of the client's access to the document. Which
+ should be used is specified by the
+ <code>
field; M
+ means that the file's last modification time should be used as
+ the base time, and A means the client's access
+ time should be used.
The difference in effect is subtle. If M is used, + all current copies of the document in all caches will expire at + the same time, which can be good for something like a weekly + notice that's always found at the same URL. If A is + used, the date of expiration is different for each client; this + can be good for image files that don't change very often, + particularly for a set of related documents that all refer to + the same images (i.e., the images will be accessed + repeatedly within a relatively short timespan).
+ +Example:
+Note that this directive only has effect if
+ ExpiresActive On
has been specified. It overrides,
+ for the specified MIME type only, any expiration date
+ set by the
You can also specify the expiration time calculation using + an alternate syntax, described earlier in + this document.
+This directive sets the default algorithm for calculating the
+ expiration time for all documents in the affected realm. It can be
+ overridden on a type-by-type basis by the
This is an experimental module and should
+ be used with care. Test your
Even when the performance characteristics are not suitable
+ for production use, mod_ext_filter
can be used as
+ a prototype environment for filters.
+ # mod_ext_filter directive to define a filter to HTML-ize text/c files + # using the external program /usr/bin/enscript, with the type of the + # result set to text/html + ExtFilterDefine c-to-html mode=output intype=text/c outtype=text/html \ + cmd="/usr/bin/enscript --color -W html -Ec -o - -" + + <Directory "/export/home/trawick/apacheinst/htdocs/c"> + + # core directive to cause the new filter to be run on output + SetOutputFilter c-to-html + + # mod_mime directive to set the type of .c files to text/c + AddType text/c .c + + # mod_ext_filter directive to set the debug level just high + # enough to see a log message per request showing the configuration + # in force + ExtFilterOptions DebugLevel=1 + + </Directory> ++
+ # mod_ext_filter directive to define the external filter + ExtFilterDefine gzip mode=output cmd=/bin/gzip + + <Location /gzipped> + + # core directive to cause the gzip filter to be run on output + SetOutputFilter gzip + + # mod_header directive to add "Content-Encoding: gzip" header field + Header set Content-Encoding gzip + + </Location> ++
Note: this gzip example is just for the purposes of illustration.
+ Please refer to
+ # mod_ext_filter directive to define a filter which runs everything + # through cat; cat doesn't modify anything; it just introduces extra + # pathlength and consumes more resources + ExtFilterDefine slowdown mode=output cmd=/bin/cat preservescontentlength + + <Location /> + + # core directive to cause the slowdown filter to be run several times on + # output + SetOutputFilter slowdown slowdown slowdown + + </Location> ++
The
filtername specifies the name of the filter being + defined. This name can then be used in SetOutputFilter + directives. It must be unique among all registered filters. + At the present time, no error is reported by the + register-filter API, so a problem with duplicate names isn't + reported to the user.
+ +Subsequent parameters can appear in any order and define the + external command to run and certain other characteristics. The + only required parameter is cmd=. These parameters + are:
+ +cmd=
keyword allows you to specify the
+ external command to run. If there are arguments after the
+ program name, the command line should be surrounded in
+ quotation marks.intype=
is
+ specified, the filter will be disabled for documents of other
+ types.PreservesContentLength
keyword specifies
+ that the filter preserves the content length. This is not the
+ default, as most filters change the content length. In the
+ event that the filter doesn't modify the length, this keyword
+ should be specified.The mod_ext_filter
.
+ Option can be one of
DebugLevel
keyword allows you to specify
+ the level of debug messages generated by
+ mod_ext_filter
. By default, no debug messages
+ are generated. This is equivalent to
+ DebugLevel=0
. With higher numbers, more debug
+ messages are generated, and server performance will be
+ degraded. The actual meanings of the numeric values are
+ described with the definitions of the DBGLVL_ constants
+ near the beginning of mod_ext_filter.c
.
+
+ Note: The core directive LogLevel should be used to + cause debug messages to be stored in the Apache error + log.
+LogStderr
keyword specifies that
+ messages written to standard error by the external filter
+ program will be saved in the Apache error log.
+ NoLogStderr
disables this feature.Example:
+Messages written to the filter's standard error will be stored
+ in the Apache error log. No debug messages will be generated by
+
Caching frequently requested files that change very + infrequently is a technique for reducing server load. + mod_file_cache provides two techniques for caching frequently + requested static files. Through configuration + directives, you can direct mod_file_cache to either open then + mmap()a file, or to pre-open a file and save the file's open + file handle. Both techniques reduce server load when + processing requests for these files by doing part of the work + (specifically, the file I/O) for serving the file when the + server is started rather than during each request.
+ +Notice: You cannot use this for speeding up CGI programs or + other files which are served by special content handlers. It + can only be used for regular files which are usually served by + the Apache core content handler.
+ +This module is an extension of and borrows heavily from the + mod_mmap_static module in Apache 1.3.
+Not all platforms support both directives. For example, Apache
+ on Windows does not currently support the
The mmap()
. This system call is available on most modern
+ Unix derivates, but not on all. There are sometimes
+ system-specific limits on the size and number of files that can be
+ mmap()d, experimentation is probably the easiest way to find
+ out.
This mmap()ing is done once at server start or restart,
+ only. So whenever one of the mapped files changes on the
+ filesystem you have to restart the server (see the Stopping and Restarting
+ documentation). To reiterate that point: if the files are
+ modified in place without restarting the server you
+ may end up serving requests that are completely bogus. You
+ should update files by unlinking the old copy and putting a new
+ copy in place. Most tools such as rdist
and
+ mv
do this. The reason why this modules doesn't
+ take care of changes to the files is that this check would need
+ an extra stat()
every time which is a waste and
+ against the intent of I/O reduction.
The
Insert more details about sendfile API...
+ +This file handle caching is done once at server start or
+ restart, only. So whenever one of the cached files changes on
+ the filesystem you have to restart the server (see the
+ Stopping and Restarting
+ documentation). To reiterate that point: if the files are
+ modified in place without restarting the server you
+ may end up serving requests that are completely bogus. You
+ should update files by unlinking the old copy and putting a new
+ copy in place. Most tools such as rdist
and
+ mv
do this.
The
Be careful with the file-path arguments: They have
+ to literally match the filesystem path Apache's URL-to-filename
+ translation handlers create. We cannot compare inodes or other
+ stuff to match paths through symbolic links etc.
+ because that again would cost extra stat()
system
+ calls which is not acceptable. This module may or may not work
+ with filenames rewritten by
The
Be careful with the file-path arguments: They have
+ to literally match the filesystem path Apache's URL-to-filename
+ translation handlers create. We cannot compare inodes or other
+ stuff to match paths through symbolic links etc.
+ because that again would cost extra stat()
system
+ calls which is not acceptable. This module may or may not work
+ with filenames rewritten by
This module provides directives to control and modify HTTP + request and response headers. Headers can be merged, replaced + or removed.
+The directives provided by mod_header can occur almost + anywhere within the server configuration. They are valid in the + main server config and virtual host sections, inside + <Directory>, <Location> and <Files> sections, + and within .htaccess files.
+ +The directives are processed in the following order:
+ +Order is important. These two headers have a different + effect if reversed:
+ +This way round, the MirrorID header is not set. If reversed, + the MirrorID header is set to "mirror 12".
+This directive can replace, merge or remove HTTP request + headers. The header is modified just before the content handler + is run, allowing incoming headers to be modified. The action it + performs is determined by the first argument. This can be one + of the following values:
+ +This argument is followed by a header name, which can
+ include the final colon, but it is not required. Case is
+ ignored. For add
, append
and
+ set
a value is given as the third argument. If
+ this value contains spaces, it should be surrounded by double
+ quotes. For unset, no value should be given.
The
This directive can replace, merge or remove HTTP response + headers. The header is modified just after the content handler + and output filters are run, allowing outgoing headers to be + modified. The action it performs is determined by the first + argument. This can be one of the following values:
+ +This argument is followed by a header name, which + can include the final colon, but it is not required. Case is + ignored for set, append, add and unset. The header + name for echo is case sensitive and may be a regular + expression.
+ +For add
, append
and
+ set
a value is specified as the third
+ argument. If value contains spaces, it should be
+ surrounded by doublequotes. value may be a character
+ string, a string containing format specifiers or a combination
+ of both. The following format specifiers are supported in
+ value:
%t: | The time the request was received in Universal +Coordinated Time since the epoch (Jan. 1, 1970) measured in +microseconds. The value is preceded by "t=". |
%D: | The time from when the request was received to +the time the headers are sent on the wire. This is a measure of the +duration of the request. The value is preceded by "D=". |
%{FOOBAR}e: | The contents of the environment +variable FOOBAR. |
When the add
, append
, or set
+ argument, a fourth argument may be used to specify conditions
+ under which the action will be taken. If the environment variable specified in the
+ env=...
argument exists (or if the environment
+ variable does not exist and env=!...
is specified)
+ then the action specified by the
The Header directives are processed just before the response + is sent to the network. These means that it is possible to set + and/or override most headers, except for those headers added by + the header filter.
+This module processes .map
files, thereby
+ replacing the functionality of the imagemap
CGI
+ program. Any directory or document type configured to use the
+ handler imap-file
(using either
+
The following directive will activate files ending with
+ .map
as imagemap files:
Note that the following is still supported:
+ +However, we are trying to phase out "magic MIME types" so we + are deprecating this method.
+The imagemap module adds some new features that were not + possible with previously distributed imagemap programs.
+ +base
.imagemap.conf
file.The lines in the imagemap files can have one of several + formats:
+ +The directive is one of base
,
+ default
, poly
, circle
,
+ rect
, or point
. The value is an
+ absolute or relative URL, or one of the special values listed
+ below. The coordinates are x,y
pairs separated by
+ whitespace. The quoted text is used as the text of the link if
+ a imagemap menu is generated. Lines beginning with '#' are
+ comments.
There are six directives allowed in the imagemap file. The + directives can come in any order, but are processed in the + order they are found in the imagemap file.
+ +base
Directive<BASE HREF="value">
.
+ The non-absolute URLs of the map-file are taken relative to
+ this value. The base
directive overrides
+ ImapBase as set in a .htaccess file or in the server
+ configuration files. In the absence of an ImapBase
+ configuration directive, base
defaults to
+ http://server_name/
.base_uri
is synonymous with base
.
+ Note that a trailing slash on the URL is significant.default
Directivepoly
, circle
or
+ rect
directives, and there are no
+ point
directives. Defaults to
+ nocontent
in the absence of an ImapDefault
+ configuration setting, causing a status code of 204 No
+ Content
to be returned. The client should keep the
+ same page displayed.poly
Directivecircle
rect
Directivepoint
Directivedefault
will not be
+ followed if a point
directive is present and
+ valid coordinates are given.The values for each of the directives can any of the following:
+ + +base
value.base
itself will not resolved according to the
+ current value. A statement base mailto:
will
+ work properly, though.map
menu
map
.referer
http://servername/
if no Referer: header was
+ present.nocontent
204 No Content
,
+ telling the client to keep the same page displayed. Valid for
+ all but base
.error
500 Server Error
. Valid for all
+ but base
, but sort of silly for anything but
+ default
.0,0 200,200
x
and a y
+ value separated by a comma. The coordinates are separated
+ from each other by whitespace. To accommodate the way Lynx
+ handles imagemaps, should a user select the coordinate
+ 0,0
, it is as if no coordinate had been
+ selected."Menu Text"
<a HREF="http://foo.com/">Menu
+ text</a>
<a
+ HREF="http://foo.com/">http://foo.com</a>
The
none
none
, no menu is generated,
+ and the default
action is performed.formatted
formatted
menu is the simplest menu.
+ Comments in the imagemap file are ignored. A level one header
+ is printed, then an hrule, then the links each on a separate
+ line. The menu has a consistent, plain look close to that of
+ a directory listing.semiformatted
semiformatted
menu, comments are
+ printed where they occur in the imagemap file. Blank lines
+ are turned into HTML breaks. No header or hrule is printed,
+ but otherwise the menu is the same as a
+ formatted
menu.unformatted
The default
used in the imagemap files. Its value is
+ overridden by a default
directive within the
+ imagemap file. If not present, the default
action
+ is nocontent
, which means that a 204 No
+ Content
is sent to the client. In this case, the client
+ should continue to display the original page.
base
for imagemap filesThe base
used in the imagemap files. Its value is
+ overridden by a base
directive within the imagemap
+ file. If not present, the base
defaults to
+ http://servername/
.
This module provides a filter which will process files + before they are sent to the client. The processing is + controlled by specially formated SGML comments, referred to as + elements. These elements allow conditional text, the + inclusion other files or programs, as well as the setting and + printing of environment variables.
+ +Server Side Includes are implemented by the
+ INCLUDES
filter. If
+ documents containing server-side include directives are given
+ the extension .shtml, the following directives will make Apache
+ parse them and assign the resulting document the mime type of
+ text/html
:
The following directive must be given for the directories
+ containing the shtml files (typically in a
+ <Directory>
section, but this directive is
+ also valid .htaccess files if AllowOverride
+ Options
is set):
For backwards compatibility, the server-parsed
+ handler also activates the
+ INCLUDES filter. As well, Apache will activate the INCLUDES
+ filter for any document with mime type
+ text/x-server-parsed-html
or
+ text/x-server-parsed-html3
(and the resulting
+ output will have the mime type text/html
).
For more information, see our Tutorial on Server Side + Includes.
+The document is parsed as an HTML document, with special + commands embedded as SGML comments. A command has the syntax:
+ +<!--#
element attribute=value
+ attribute=value ... -->
+ The value will often be enclosed in double quotes; many + commands only allow a single attribute-value pair. Note that + the comment terminator (-->) should be preceded + by whitespace to ensure that it isn't considered part of an SSI + token.
+ +The allowed elements are:
+ +bytes
+ for a count in bytes, or abbrev
for a count
+ in Kb or Mb as appropriate.strftime(3)
library routine when printing
+ dates.(none)
. Any dates printed are subject to the
+ currently configured timefmt
. Attributes:
+
+ echo
element,
+ the default is set to "entity", resulting in entity
+ encoding (which is appropriate in the context of a
+ block-level HTML element, eg. a paragraph of text). This
+ can be changed by adding an encoding
+ attribute, which will remain in effect until the next
+ encoding
attribute is encountered or the
+ element ends, whichever comes first. Note that the
+ encoding
attribute must precede the
+ corresponding var
attribute to be effective,
+ and that only special characters as defined in the
+ ISO-8859-1 character encoding will be encoded. This
+ encoding process may not have the desired result if a
+ different character encoding is in use. Apache 1.3.12 and
+ above; previous versions do no encoding.The CGI script is given the PATH_INFO and query + string (QUERY_STRING) of the original request from the + client; these cannot be specified in the URL path. The + include variables will be available to the script in + addition to the standard CGI + environment.
+ +For example:
+ +<!--#exec cgi="/cgi-bin/example.cgi" -->
+
+ If the script returns a Location: header instead of + output, then this will be translated into an HTML + anchor.
+ +The include
+ virtual
element should be
+ used in preference to exec cgi
. In particular,
+ if you need to pass additional arguments to a CGI program,
+ using the query string, this cannot be done with exec
+ cgi
, but can be done with include
+ virtual
, as shown here:
<!--#include virtual="/cgi-bin/example.cgi?argument=value" -->
+ The server will execute the given string using
+ /bin/sh
. The include variables are available
+ to the command, in addition to the usual set of CGI
+ variables.
The use of #include
+ virtual
is almost always
+ prefered to using either #exec cgi
or #exec
+ cmd
. The former (#include virtual
) used the
+ standard Apache sub-request mechanism to include files or
+ scripts. It is much better tested and maintained.
In addition, on some platforms, like Win32, and on unix
+ when using suexec, you cannot pass arguments to a command in
+ an exec
directive, or otherwise include spaces in
+ the command. Thus, while the following will work under a
+ non-suexec configuration on unix, it will not produce the
+ desired result under Win32, or when running suexec:
<!--#exec cmd="perl /path/to/perlscript arg1 arg2" -->
+
+ sizefmt
format specification.
+ Attributes:
+
+ timefmt
format
+ specification. The attributes are the same as for the
+ fsize
command.An attribute defines the location of the document; the + inclusion is done for each attribute given to the include + command. The valid attributes are:
+ +../
, nor can it be an absolute path.
+ Therefore, you cannot include files that are outside of the
+ document root, or above the current document in the directory
+ structure.
+ The virtual
attribute should always be used
+ in preference to this one.The value is a (%-encoded) URL relative to the + current document being parsed. The URL cannot contain a + scheme or hostname, only a path and an optional query + string. If it does not begin with a slash (/) then it is + taken to be relative to the current document.
+ +A URL is constructed from the attribute, and the output the + server would return if the URL were accessed by the client + is included in the parsed output. Thus included files can + be nested.
+ +If the specified URL is a CGI program, the program will + be executed and its output inserted in place of the directive + in the parsed file. You may include a query string in a CGI + url:
+ +<!--#include virtual="/cgi-bin/example.cgi?argument=value" -->
+
+ include virtual
should be used in preference
+ to exec cgi
to include the output of CGI
+ programs into an HTML document.
This prints out a listing of all existing variables and
+ their values. Starting with Apache 1.3.12, special characters
+ are entity encoded (see the echo
element for details)
+ before being output. There are no attributes.
For example:
+ +<!--#printenv -->
The printenv element is available only in + Apache 1.2 and above.
+
+ For example: <!--#set var="category" value="help"
+ -->
The set element is available only in + Apache 1.2 and above.
+echo
command, for
+ if
and elif
, and to any program
+ invoked by the document.
+
+ Variable substitution is done within quoted strings in most + cases where they may reasonably occur as an argument to an SSI + directive. This includes the config, + exec, flastmod, fsize, + include, and set directives, as well + as the arguments to conditional operators. You can insert a + literal dollar sign into the string using backslash + quoting:
++ <!--#if expr="$a = \$test" --> ++ +
If a variable reference needs to be substituted in the + middle of a character sequence that might otherwise be + considered a valid identifier in its own right, it can be + disambiguated by enclosing the reference in braces, + a la shell substitution:
++ <!--#set var="Zed" value="${REMOTE_HOST}_${REQUEST_METHOD}" --> ++ +
This will result in the Zed variable being set + to "X_Y" if REMOTE_HOST is + "X" and REQUEST_METHOD is + "Y".
+ +EXAMPLE: the below example will print "in foo" if the + DOCUMENT_URI is /foo/file.html, "in bar" if it is + /bar/file.html and "in neither" otherwise:
++ <!--#if expr="\"$DOCUMENT_URI\" = \"/foo/file.html\"" --> + in foo + <!--#elif expr="\"$DOCUMENT_URI\" = \"/bar/file.html\"" --> + in bar + <!--#else --> + in neither + <!--#endif --> ++
+ <!--#if expr="test_condition" --> + <!--#elif expr="test_condition" --> + <!--#else --> + <!--#endif --> ++ +
The if
element works like an
+ if statement in a programming language. The test condition is
+ evaluated and if the result is true, then the text until the
+ next elif
,
+ else
. or
+ endif
element is included in the
+ output stream.
The elif
or
+ else
statements are be used the
+ put text into the output stream if the original test_condition
+ was false. These elements are optional.
The endif
element ends the
+ if
element and is required.
test_condition is one of the following:
+ +"=" and "!=" bind more tightly than + "&&" and "||". "!" binds + most tightly. Thus, the following are equivalent:
++ <!--#if expr="$a = test1 && $b = test2" --> + <!--#if expr="($a = test1) && ($b = test2)" --> ++ +
Anything that's not recognized as a variable or an operator + is treated as a string. Strings can also be quoted: + 'string'. Unquoted strings can't contain whitespace + (blanks and tabs) because it is used to separate tokens such as + variables. If multiple strings are found in a row, they are + concatenated using blanks. So,
++ string1 string2 results in string1 string2 + 'string1 string2' results in string1 string2 ++ +
Files processed for server-side includes no longer accept + requests with PATH_INFO (trailing pathname information) by + default. You can use the AcceptPathInfo directive to + configure the server to accept requests with PATH_INFO.
+ +This directive changes the string that mod_include looks for + to mark the end of a include command.
+ +The SSIErrorMsg directive changes the error message displayed
+ when mod_include encounters an error. For production servers you
+ may consider changing the default error message to
+ "<-- Error -->"
so that the message
+ is not presented to the user.
+
This directive has the same effect as the <--#config
+ errmsg=message -->
element.
This directive changes the string that mod_include looks for + to mark an include element to process.
+ +You may want to use this option if have 2 servers parsing the + output of a file each processing different commands (possibly at + different times).
+ +This directive changes the format in which date strings are displayed + when echoing DATE environment variables. The formatstring + is as in strftime(3) from the C standard library.
+ +This directive has the same effect as the <--#config
+ timefmt=formatstring -->
element.
The XBitHack directives controls the parsing of ordinary
+ html documents. This directive only affects files associated
+ with the MIME type text/html
. XBitHack can take on
+ the following values:
on
but also test the group-execute bit.
+ If it is set, then set the Last-modified date of the
+ returned file to be the last modified time of the file. If
+ it is not set, then no last-modified date is sent. Setting
+ this bit allows clients and proxies to cache the result of
+ the request.
+
+ Note: you would not want to use the full
+ option, unless you assure the group-execute bit is unset for
+ every SSI script which might #include
a CGI
+ or otherwise produces different output on each hit (or could
+ potentially change on subsequent requests).
To configure it, add the following to your
+ httpd.conf
file.
Once configured, the server information is obtained by
+ accessing http://your.host.dom/server-info
It should also be noted that if
+ .htaccess
). This may have security-related
+ ramifications for your site.
This allows the content of string to be shown as + HTML interpreted, Additional Information for + the module module-name. Example:
+ +This module implements the Internet Server extension API. It + allows Internet Server extensions (e.g. ISAPI .dll + modules) to be served by Apache for Windows, subject to the + noted restrictions.
+ +ISAPI extension modules (.dll files) are written by third + parties. The Apache Group does not author these modules, so we + provide no support for them. Please contact the ISAPI's author + directly if you are experiencing problems running their ISAPI + extention. Please do not post such problems to + Apache's lists or bug reporting pages.
+In the server configuration file, use
+the isapi-isa
handler, and map
+it to the with their file extensions. To enable any .dll file to be
+processed as an ISAPI extention, edit the httpd.conf file and add the
+following line:
There is no capability within the Apache server to leave a + requested module loaded. However, you may preload and keep a + specific module loaded by using the following syntax in your + httpd.conf:
+Whether or not you have preloaded an ISAPI extension, all
+ ISAPI extensions are governed by the same permissions and
+ restrictions as CGI scripts. That is, Options
+ ExecCGI
must be set for the directory that contains the
+ ISAPI .dll file.
Review the Additional Notes and the Programmer's Journal for additional details + and clarification of the specific ISAPI support offered by + mod_isapi.
+Apache's ISAPI implementation conforms to all of the ISAPI
+ 2.0 specification, except for some "Microsoft-specific"
+ extensions dealing with asynchronous I/O. Apache's I/O model
+ does not allow asynchronous reading and writing in a manner
+ that the ISAPI could access. If an ISA tries to access
+ unsupported features, including async I/O, a message is placed
+ in the error log to help with debugging. Since these messages
+ can become a flood, the directive ISAPILogNotSupported
+ Off
exists to quiet this noise.
Some servers, like Microsoft IIS, load the ISAPI extension + into the server and keep it loaded until memory usage is too + high, or unless configuration options are specified. Apache + currently loads and unloads the ISAPI extension each time it is + requested, unless the ISAPICacheFile directive is specified. + This is inefficient, but Apache's memory model makes this the + most effective method. Many ISAPI modules are subtly + incompatible with the Apache server, and unloading these + modules helps to ensure the stability of the server.
+ +Also, remember that while Apache supports ISAPI Extensions, + it does not support ISAPI Filters. Support for + filters may be added at a later date, but no support is planned + at this time.
+If you are programming Apache 2.0
Apache returns FALSE to any unsupported call to + ServerSupportFunction, and sets the GetLastError value to + ERROR_INVALID_PARAMETER.
+ +ReadClient retrieves the request body exceeding the initial + buffer (defined by ISAPIReadAheadBuffer). Based on the + ISAPIReadAheadBuffer setting (number of bytes to buffer prior + to calling the ISAPI handler) shorter requests are sent + complete to the extension when it is invoked. If the request is + longer, the ISAPI extension must use ReadClient to retrieve the + remaining request body.
+ +WriteClient is supported, but only with the HSE_IO_SYNC flag + or no option flag (value of 0). Any other WriteClient request + will be rejected with a return value of FALSE, and a + GetLastError value of ERROR_INVALID_PARAMETER.
+ +GetServerVariable is supported, although extended server + variables do not exist (as defined by other servers.) All the + usual Apache CGI environment variables are available from + GetServerVariable, as well as the ALL_HTTP and ALL_RAW + values.
+ +Apache 2.0
Specifies a space-separated list of file names to be loaded + when the Apache server is launched, and remain loaded until the + server is shut down. This directive may be repeated for every + ISAPI .dll file desired. The full path name of each file should + be specified.
+Defines the maximum size of the Read Ahead Buffer sent to + ISAPI extensions when they are initially invoked. All remaining + data must be retrieved using the ReadClient callback; some + ISAPI extensions may not support the ReadClient function. Refer + questions to the ISAPI extension's author.
+Logs all requests for unsupported features from ISAPI + extensions in the server error log. While this should be turned + off once all desired ISAPI modules are functioning, it defaults + to on to help administrators track down problems.
+Record HSE_APPEND_LOG_PARAMETER requests from ISAPI + extensions to the server error log.
+Record HSE_APPEND_LOG_PARAMETER requests from ISAPI + extensions to the query field (appended to the CustomLog %q + component).
+This module provides for flexible logging of client + requests. Logs are written in a customizable format, and may be + written directly to a file, or to an external program. + Conditional logging is provided so that individual requests may + be included or excluded from the logs based on characteristics + of the request.
+ +Three directives are provided by this module:
+ TransferLog
to create a log file,
+ LogFormat
to set a custom format, and
+ CustomLog
to define a log file and format in one
+ step. The TransferLog
and CustomLog
+ directives can be used multiple times in each server to cause
+ each request to be logged to multiple files.
The format argument to the LogFormat
and
+ CustomLog
directives is a string. This string is
+ logged to the log file for each request. It can contain literal
+ characters copied into the log files and the c-type control
+ characters "\n" and "\t" to represent new-lines and tabs.
+ Literal quotes and back-slashes should be escaped with
+ back-slashes.
The characteristics of the request itself are logged by + placing "%" directives in the format string, which are replaced + in the log file by the values as follows:
+ +%...a: | +Remote IP-address |
%...A: | +Local IP-address |
%...B: | +Bytes sent, excluding HTTP headers. |
%...b: | +Bytes sent, excluding HTTP headers. In CLF format +i.e. a '-' rather than a 0 when no bytes are sent. |
%...{Foobar}C: | +The contents of cookie "Foobar" in the request sent to the server. |
%...D: | +The time taken to serve the request, in microseconds. |
%...{FOOBAR}e: | +The contents of the environment variable FOOBAR |
%...f: | +Filename |
%...h: | +Remote host |
%...H | +The request protocol |
%...{Foobar}i: | +The contents of Foobar: header line(s) in the request +sent to the server. |
%...l: | +Remote logname (from identd, if supplied) |
%...m: | +The request method |
%...{Foobar}n: | +The contents of note "Foobar" from another module. |
%...{Foobar}o: | +The contents of Foobar: header line(s) in the reply. |
%...p: | +The canonical Port of the server serving the request |
%...P: | +The process ID of the child that serviced the request. |
%...q: | +The query string (prepended with a ? if a query string exists, +otherwise an empty string) |
%...r: | +First line of request |
%...s: | +Status. For requests that got internally redirected, this is +the status of the *original* request --- %...>s for the last. |
%...t: | +Time, in common log format time format (standard english format) |
%...{format}t: | +The time, in the form given by format, which should +be in strftime(3) format. (potentially localized) |
%...T: | +The time taken to serve the request, in seconds. |
%...u: | +Remote user (from auth; may be bogus if return status (%s) is 401) |
%...U: | +The URL path requested, not including any query string. |
%...v: | +The canonical ServerName of the server serving the request. |
%...V: | +The server name according to the UseCanonicalName setting. |
%...X: | +Connection status when response is completed.
+ +'+' = connection may be kept alive after the response is sent. +'-' = connection will be closed after the response is sent. + |
The "..." can be nothing at all (e.g., "%h %u
+ %r %s %b"
), or it can indicate conditions for inclusion
+ of the item (which will cause it to be replaced with "-" if the
+ condition is not met). The forms of condition are a list of
+ HTTP status codes, which may or may not be preceded by "!".
+ Thus, "%400,501{User-agent}i" logs User-agent: on 400 errors
+ and 501 errors (Bad Request, Not Implemented) only;
+ "%!200,304,302{Referer}i" logs Referer: on all requests which
+ did not return some sort of normal status.
Note that there is no escaping performed on the strings from + %...r, %...i and %...o. This is mainly to comply with the + requirements of the Common Log Format. This implies that + clients can insert control characters into the log, so care + should be taken when dealing with raw log files.
+ +Some commonly used log format strings are:
+ +"%h %l %u %t \"%r\" %>s %b"
"%v %h %l %u %t \"%r\" %>s %b"
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
+ \"%{User-agent}i\""
"%{Referer}i -> %U"
"%{User-agent}i"
Note that the canonical ServerName and Listen of the server serving the
+ request are used for %v
and %p
+ respectively. This happens regardless of the UseCanonicalName setting
+ because otherwise log analysis programs would have to duplicate
+ the entire vhost matching algorithm in order to decide what
+ host really served the request.
See the security tips + document for details on why your security could be compromised + if the directory where logfiles are stored is writable by + anyone other than the user that starts the server.
+ +The
The
The first argument, which specifies the location to which + the logs will be written, can take on one of the following two + types of values:
+ +|
", followed by the path
+ to a program to receive the log information on its standard
+ input. Security: if a program is used, then
+ it will be run under the user who started httpd. This will be
+ root if the server was started by root; be sure that the
+ program is secure.The second argument specifies what will be written to the + log file. It can specify either a nickname defined by + a previous LogFormat directive, or it + can be an explicit format string as described in the + log formats section.
+ +For example, the following two sets of directives have + exactly the same effect:
+ +The third argument is optional and allows the decision on
+ whether or not to log a particular request to be based on the
+ presence or absence of a particular variable in the server
+ environment. If the specified environment
+ variable is set for the request (or is not set, in the case
+ of a 'env=!name
' clause), then the
+ request will be logged.
Environment variables can be set on a per-request
+ basis using the
This directive specifies the format of the access log + file.
+ +The
The second form of the
This directive has exactly the same arguments and effect as
+ the
Example:
+This module is used to associate various bits of "meta
+ information" with files by their filename extensions. This
+ information relates the filename of the document to it's
+ mime-type, language, character set and encoding. This
+ information is sent to the browser, and participates in content
+ negotiation, so the user's preferences are respected when
+ choosing one of several possible files to serve. See
+
The directives
In addition, mod_mime may define the "handler" for a + document, which controls which module or script will serve the + document. With the introduction of "filters" in Apache 2.0, + mod_mime can also define the filters that the the content + should be processed through (e.g. the Includes output filter + for server side scripting) and what filters the client request + and POST content should be processed through (the input + filters.)
+ +The directives
The directive http://www.isi.edu/in-notes/iana/assignments/media-types/media-types
+ although it may be mirrored elsewhere). This simplifies the
+ httpd.conf file by providing the majority of media-type
+ definitions, and they may be overridden by
+
The core directives
Note that changing the type or encoding of a file does not
+ change the value of the Last-Modified
header.
+ Thus, previously cached copies may still be used by a client or
+ proxy, with the previous headers. If you change the
+ meta-information (language, content type, character set or
+ encoding) you may need to 'touch' affected files (updating
+ their last modified date) to ensure that all visitors are
+ receive the corrected content headers.
Files can have more than one extension, and the order of the
+ extensions is normally irrelevant. For example, if the
+ file welcome.html.fr
maps onto content type
+ text/html and language French then the file welcome.fr.html
+ will map onto exactly the same information. If more than one
+ extension is given which maps onto the same
+ type of meta-information, then the one to the right will be
+ used. For example, if ".gif" maps to the MIME-type image/gif
+ and ".html" maps to the MIME-type text/html, then the file
+ welcome.gif.html
will be associated with the
+ MIME-type "text/html".
Care should be taken when a file with multiple extensions
+ gets associated with both a MIME-type and a handler. This will
+ usually result in the request being by the module associated
+ with the handler. For example, if the .imap
+ extension is mapped to the handler "imap-file" (from mod_imap)
+ and the .html
extension is mapped to the MIME-type
+ "text/html", then the file world.imap.html
will be
+ associated with both the "imap-file" handler and "text/html"
+ MIME-type. When it is processed, the "imap-file" handler will
+ be used, and so it will be treated as a mod_imap imagemap
+ file.
A file of a particular MIME type can additionally be encoded a + particular way to simplify transmission over the Internet. + While this usually will refer to compression, such as + gzip, it can also refer to encryption, such a + pgp or to an encoding such as UUencoding, which is + designed for transmitting a binary file in an ASCII (text) + format.
+ +The MIME RFC puts it this way:
+ +By using more than one file extension (see section above about multiple file + extensions), you can indicate that a file is of a + particular type, and also has a particular + encoding.
+ +For example, you may have a file which is a Microsoft Word + document, which is pkzipped to reduce its size. If the + .doc extension is associated with the Microsoft + Word file type, and the .zip extension is + associated with the pkzip file encoding, then the file + Resume.doc.zipwould be known to be a pkzip'ed Word + document.
+ +Apache send a Content-encoding header with the + resource, in order to tell the client browser about the + encoding method.
+ +In addition to file type and the file encoding, + another important piece of information is what language a + particular document is in, and in what character set the file + should be displayed. For example, the document might be written + in the Vietnamese alphabet, or in Cyrillic, and should be + displayed as such. This information, also, is transmitted in + HTTP headers.
+ +The character set, language encoding and mime type are all
+ used in the process of content negotiation (See
+
To convey this further information, Apache optionally sends + a Content-Language header, to specify the language + that the document is in, and can append additional information + onto the Content-Type header to indicate the + particular character set that should be used to correctly + render the information.
+ +The language specification is the two-letter abbreviation + for the language. The charset is the name of the + particular character set which should be used.
+The AddCharset directive maps the given filename extensions + to the specified content charset. charset is the MIME + charset parameter of filenames containing extension. + This mapping is added to any already in force, overriding any + mappings that already exist for the same extension.
+ +Example:
+Then the document xxxx.ja.jis
will be treated
+ as being a Japanese document whose charset is ISO-2022-JP (as
+ will the document xxxx.jis.ja
). The AddCharset
+ directive is useful for both to inform the client about the
+ character encoding of the document so that the document can be
+ interpreted and displayed appropriately, and for content negotiation,
+ where the server returns one from several documents based on
+ the client's charset preference.
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+ +The AddEncoding directive maps the given filename extensions + to the specified encoding type. MIME-enc is the MIME + encoding to use for documents containing the + extension. This mapping is added to any already in + force, overriding any mappings that already exist for the same + extension. Example:
+ +This will cause filenames containing the .gz extension to be + marked as encoded using the x-gzip encoding, and filenames + containing the .Z extension to be marked as encoded with + x-compress.
+ +Old clients expect x-gzip
and
+ x-compress
, however the standard dictates that
+ they're equivalent to gzip
and
+ compress
respectively. Apache does content
+ encoding comparisons by ignoring any leading x-
.
+ When responding with an encoding Apache will use whatever form
+ (i.e., x-foo
or foo
) the
+ client requested. If the client didn't specifically request a
+ particular form Apache will use the form given by the
+ AddEncoding
directive. To make this long story
+ short, you should always use x-gzip
and
+ x-compress
for these two specific encodings. More
+ recent encodings, such as deflate
should be
+ specified without the x-
.
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+ +This mapping is added to any already in
+ force, overriding any mappings that already exist for the same
+ extension. For example, to activate CGI scripts with
+ the file extension ".cgi
", you might use:
Once that has been put into your srm.conf or httpd.conf
+ file, any file containing the ".cgi
" extension
+ will be treated as a CGI program.
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+ +AddInputFilter maps the filename extensions + extension to the filter or filters which will process + client requests and POST input when they are received by the + server. This is in addition to any filters defined elsewhere, + including the SetInputFilter directive. + This mapping is merged over any already in force, overriding + any mappings that already exist for the same + extension.
+ +If more than one filter is specified, they must be separated + by semicolons in the order in which they should process the + content. Both the filter and extension arguments are + case-insensitive, and the extension may be specified with or + without a leading dot.
+ +The AddLanguage directive maps the given filename extension + to the specified content language. MIME-lang is the + MIME language of filenames containing extension. This + mapping is added to any already in force, overriding any + mappings that already exist for the same + extension.
+ +Example:
+ +Then the document xxxx.en.Z
will be treated as
+ being a compressed English document (as will the document
+ xxxx.Z.en
). Although the content language is
+ reported to the client, the browser is unlikely to use this
+ information. The AddLanguage directive is more useful for content negotiation,
+ where the server returns one from several documents based on
+ the client's language preference.
If multiple language assignments are made for the same + extension, the last one encountered is the one that is used. + That is, for the case of:
+ +documents with the extension ".en
" would be
+ treated as being "en-us
".
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+ +The
For example, the following configuration will process all + .shtml files for server-side includes.
+ + +If more than one filter is specified, they must be separated + by semicolons in the order in which they should process the + content. Both the filter and extension arguments are + case-insensitive, and the extension may be specified with or + without a leading dot.
+ +The AddType directive maps the given filename extensions
+ onto the specified content type. MIME-type is the MIME
+ type to use for filenames containing extension. This
+ mapping is added to any already in force, overriding any
+ mappings that already exist for the same extension.
+ This directive can be used to add mappings not listed in the
+ MIME types file (see the
Example:
+ +The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+ +MultiviewsMatch permits three different behaviors for + mod_negotiation's Multiviews + feature. Multiviews allows a request for a file, e.g. index.html, + to match any negotiated extensions following the base request, + e.g. index.html.en, index.html,fr, or index.html.gz.
+ +The NegotiatedOnly option provides that every extension following + the base name must correlate to a recognized mod_mime extension for + content negotation, e.g. Charset, Content-Type, Language, or + Encoding. This is the strictest implementation with the fewest + unexpected side effects, and is the default behavior.
+ +To include extensions associated with Handlers and/or Filters, + set the MultiviewsMatch directive to either Handlers, Filters, or + both option keywords. If all other factors are equal, the smallest + file will be served, e.g. in deciding between index.html.cgi of 500 + characters and index.html.pl of 1000 bytes, the .cgi file would win + in this example. Users of .asis files might prefer to use the + Handler option, if .asis files are associated with the asis-handler.
+ +You may finally allow Any extensions to match, even if mod_mime + doesn't recognize the extension. This was the behavior in Apache 1.3, + and can cause unpredicatable results, such as serving .old or .bak + files the webmaster never expected to be served.
+The DefaultLanguage directive tells Apache that all files in
+ the directive's scope (e.g., all files covered by the
+ current <Directory>
container) that don't
+ have an explicit language extension (such as .fr
+ or .de as configured by AddLanguage)
+ should be considered to be in the specified MIME-lang
+ language. This allows entire directories to be marked as
+ containing Dutch content, for instance, without having to
+ rename each file. Note that unlike using extensions to specify
+ languages, DefaultLanguage can only specify a
+ single language.
If no DefaultLanguage directive is in force, + and a file does not have any language extensions as configured + by AddLanguage, then that file will be considered + to have no language attribute.
+ +The RemoveCharset directive removes any
+ character set associations for files with the given extensions.
+ This allows .htaccess
files in subdirectories to
+ undo any associations inherited from parent directories or the
+ server config files.
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+The RemoveEncoding directive removes any
+ encoding associations for files with the given extensions. This
+ allows .htaccess
files in subdirectories to undo
+ any associations inherited from parent directories or the
+ server config files. An example of its use might be:
/foo/.htaccess:
AddEncoding x-gzip .gz
AddType text/plain .asc
<Files *.gz.asc>
RemoveEncoding
+ .gz
</Files>
This will cause foo.gz
to be marked as being
+ encoded with the gzip method, but foo.gz.asc
as an
+ unencoded plaintext file.
Note:RemoveEncoding directives are processed + after any AddEncoding directives, so it is possible they + may undo the effects of the latter if both occur within the + same directory configuration.
+ +The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+The RemoveHandler directive removes any handler
+ associations for files with the given extensions. This allows
+ .htaccess
files in subdirectories to undo any
+ associations inherited from parent directories or the server
+ config files. An example of its use might be:
/foo/.htaccess:
AddHandler server-parsed .html
/foo/bar/.htaccess:
RemoveHandler .html
This has the effect of returning .html files in + the /foo/bar directory to being treated as normal + files, rather than as candidates for parsing (see the mod_include + module).
+ +The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+The RemoveInputFilter directive removes any
+ input filter associations for files with the given extensions.
+ This allows .htaccess
files in subdirectories to
+ undo any associations inherited from parent directories or the
+ server config files.
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+The RemoveLanguage directive removes any
+ language associations for files with the given extensions. This
+ allows .htaccess
files in subdirectories to undo
+ any associations inherited from parent directories or the
+ server config files.
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+The RemoveOutputFilter directive removes any
+ output filter associations for files with the given extensions.
+ This allows .htaccess
files in subdirectories to
+ undo any associations inherited from parent directories or the
+ server config files.
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+The .htaccess
files in subdirectories to undo any
+ associations inherited from parent directories or the server
+ config files. An example of its use might be:
/foo/.htaccess:
RemoveType .cgi
This will remove any special handling of .cgi
+ files in the /foo/
directory and any beneath it,
+ causing the files to be treated as being of the default type.
The extension argument is case-insensitive, and can + be specified with or without a leading dot.
+The TypesConfig directive sets the location of the MIME + types configuration file. Filename is relative to the + ServerRoot. This file sets + the default list of mappings from filename extensions to + content types; changing this file is not recommended. Use the + AddType directive instead. The file + contains lines in the format of the arguments to an AddType + command:
+ ++ The extensions are lower-cased. Blank lines, and lines + beginning with a hash character (`#') are ignored.
+This module determines the MIME type of files in the same
+ way the Unix file(1) command works: it looks at the first few
+ bytes of the file. It is intended as a "second line of defense"
+ for cases that
This module is derived from a free version of the
+ file(1)
command for Unix, which uses "magic
+ numbers" and other hints from a file's contents to figure out
+ what the contents are. This module is active only if the magic
+ file is specified by the
The contents of the file are plain ASCII text in 4-5 + columns. Blank lines are allowed but ignored. Commented lines + use a hash mark "#". The remaining lines are parsed for the + following columns:
+ +Column | + +Description | +||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | + +byte number to begin checking from + ">" indicates a dependency upon the previous non-">" + line |
+ ||||||||||||||||||||||
2 | + +
+ type of data to match
+
+
|
+ ||||||||||||||||||||||
3 | + +contents of data to match | +||||||||||||||||||||||
4 | + +MIME type if matched | +||||||||||||||||||||||
5 | + +MIME encoding if matched (optional) | +
For example, the following magic file lines would recognize + some audio formats.
++# Sun/NeXT audio data +0 string .snd +>12 belong 1 audio/basic +>12 belong 2 audio/basic +>12 belong 3 audio/basic +>12 belong 4 audio/basic +>12 belong 5 audio/basic +>12 belong 6 audio/basic +>12 belong 7 audio/basic +>12 belong 23 audio/x-adpcm ++
Or these would recognize the difference between "*.doc" files + containing Microsoft Word or FrameMaker documents. (These are + incompatible file formats which use the same file suffix.)
++# Frame +0 string \<MakerFile application/x-frame +0 string \<MIFFile application/x-frame +0 string \<MakerDictionary application/x-frame +0 string \<MakerScreenFon application/x-frame +0 string \<MML application/x-frame +0 string \<Book application/x-frame +0 string \<Maker application/x-frame + +# MS-Word +0 string \376\067\0\043 application/msword +0 string \320\317\021\340\241\261 application/msword +0 string \333\245-\0\0\0 application/msword ++
An optional MIME encoding can be included as a fifth column. + For example, this can recognize gzipped files and set the + encoding for them.
++# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver) +0 string \037\213 application/octet-stream x-gzip ++
This module is not for every system. If your system is barely + keeping up with its load or if you're performing a web server + benchmark, you may not want to enable this because the + processing is not free.
+ +However, an effort was made to improve the performance of + the original file(1) code to make it fit in a busy web server. + It was designed for a server where there are thousands of users + who publish their own documents. This is probably very common + on intranets. Many times, it's helpful if the server can make + more intelligent decisions about a file's contents than the + file name allows ...even if just to reduce the "why doesn't my + page work" calls when users improperly name their own files. + You have to decide if the extra work suits your + environment.
+ +When compiling an Apache server, this module should be at or + near the top of the list of modules in the Configuration file. + The modules are listed in increasing priority so that will mean + this one is used only as a last resort, just like it was + designed to.
+ +The following notes apply to the mod_mime_magic module and are + included here for compliance with contributors' copyright + restrictions that require their acknowledgment.
++/* + * mod_mime_magic: MIME type lookup via file magic numbers + * Copyright (c) 1996-1997 Cisco Systems, Inc. + * + * This software was submitted by Cisco Systems to the Apache Group in July + * 1997. Future revisions and derivatives of this source code must + * acknowledge Cisco Systems as the original contributor of this module. + * All other licensing and usage conditions are those of the Apache Group. + * + * Some of this code is derived from the free version of the file command + * originally posted to comp.sources.unix. Copyright info for that program + * is included below as required. + * --------------------------------------------------------------------------- + * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin. + * + * This software is not subject to any license of the American Telephone and + * Telegraph Company or of the Regents of the University of California. + * + * Permission is granted to anyone to use this software for any purpose on any + * computer system, and to alter it and redistribute it freely, subject to + * the following restrictions: + * + * 1. The author is not responsible for the consequences of use of this + * software, no matter how awful, even if they arise from flaws in it. + * + * 2. The origin of this software must not be misrepresented, either by + * explicit claim or by omission. Since few users ever read sources, credits + * must appear in the documentation. + * + * 3. Altered versions must be plainly marked as such, and must not be + * misrepresented as being the original software. Since few users ever read + * sources, credits must appear in the documentation. + * + * 4. This notice may not be removed or altered. + * ------------------------------------------------------------------------- + * + * For compliance with Mr Darwin's terms: this has been very significantly + * modified from the free "file" command. + * - all-in-one file for compilation convenience when moving from one + * version of Apache to the next. + * - Memory allocation is done through the Apache API's pool structure. + * - All functions have had necessary Apache API request or server + * structures passed to them where necessary to call other Apache API + * routines. (i.e., usually for logging, files, or memory allocation in + * itself or a called function.) + * - struct magic has been converted from an array to a single-ended linked + * list because it only grows one record at a time, it's only accessed + * sequentially, and the Apache API has no equivalent of realloc(). + * - Functions have been changed to get their parameters from the server + * configuration instead of globals. (It should be reentrant now but has + * not been tested in a threaded environment.) + * - Places where it used to print results to stdout now saves them in a + * list where they're used to set the MIME type in the Apache request + * record. + * - Command-line flags have been removed since they will never be used here. + * + */ ++
The conf/magic
. Non-rooted paths are relative to the
+ ServerRoot. Virtual hosts will use the same file as the main
+ server unless a more specific setting is used, in which case
+ the more specific setting overrides the main server's file.
Content negotiation, or more accurately content selection, is + the selection of the document that best matches the clients + capabilities, from one of several available documents. There + are two implementations of this.
+ +type-map
) which explicitly lists the files
+ containing the variants.A type map has the same format as RFC822 mail headers. It + contains document descriptions separated by blank lines, with + lines beginning with a hash character ('#') treated as + comments. A document description consists of several header + records; records may be continued on multiple lines if the + continuation lines start with spaces. The leading space will be + deleted and the lines concatenated. A header record consists of + a keyword name, which always ends in a colon, followed by a + value. Whitespace is allowed between the header name and value, + and between the tokens of value. The headers allowed are:
+ +x-compress
+ for compress'd files, and x-gzip
for gzip'd
+ files. The x-
prefix is ignored for encoding
+ comparisons.en
,
+ meaning English.name=value
. Common parameters include:
+
+ text/html
this defaults to 2, otherwise
+ 0.
+ Content-Type: image/jpeg; qs=0.8
+
+ A MultiViews search is enabled by the MultiViews /some/dir/foo
and
+ /some/dir/foo
does not exist, then the
+ server reads the directory looking for all files named
+ foo.*
, and effectively fakes up a type map which
+ names all those files, assigning them the same media types and
+ content-encodings it would have if the client had asked for one
+ of them by name. It then chooses the best match to the client's
+ requirements, and returns that document.
If set, this directive allows content-negotiated documents + to be cached by proxy servers. This could mean that clients + behind those proxys could retrieve versions of the documents + that are not the best match for their abilities, but it will + make caching more efficient.
+ +This directive only applies to requests which come from + HTTP/1.0 browsers. HTTP/1.1 provides much better control over + the caching of negotiated documents, and this directive has no + effect in responses to HTTP/1.1 requests.
+ +Prior to version 2.0,
+
The
ForceLanguagePriority Prefer
uses
+ LanguagePriority
to serve a one valid result, rather
+ than returning an HTTP result 300 (MULTIPLE CHOICES) when there
+ are several equally valid choices. If the directives below were
+ given, and the user's Accept-Language header assigned en and de
+ each as quality .500 (equally acceptable) then then first matching
+ variant, en, will be served.
ForceLanguagePriority Fallback
uses
+ LanguagePriority
to serve a valid result, rather than
+ returning an HTTP result 406 (NOT ACCEPTABLE). If the directives
+ below were given, and the user's Accept-Language only permitted an
+ es langauge response, but such a variant isn't found, then the
+ first variant from the LanguagePriority list below will be
+ served.
Both options, Prefer and Fallback, may be specified, so either the + first matching variant from LanguagePriority will be served if more + that one variant is acceptable, or first available document will be + served if none of the variants matched the client's acceptable list of + languages.
+The
For a request for foo.html
, where
+ foo.html.fr
and foo.html.de
both
+ existed, but the browser did not express a language preference,
+ then foo.html.fr
would be returned.
Note that this directive only has an effect if a 'best'
+ language cannot be determined by any other means or the None
. Correctly implemented HTTP/1.1 requests
+ will mean this directive has no effect.
This module implements a proxy/gateway for Apache. It implements
+proxying capability for
+FTP
,
+CONNECT
(for SSL),
+HTTP/0.9
,
+HTTP/1.0
, and
+HTTP/1.1
.
+The module can be configured to connect to other proxy modules for these
+and other protocols.
This module was experimental in Apache 1.1.x. Improvements and bugfixes +were made in Apache v1.2.x and Apache v1.3.x, then the module underwent a major +overhaul for Apache v2.0. The protocol support was upgraded to HTTP/1.1, +and filter support was enabled.
+ +Please note that the caching function present in +mod_proxy up to Apache v1.3.x has been removed from +mod_proxy and will be incorporated into a new module, mod_cache.
+Apache can be configured in both a forward and reverse +proxy configuration.
+ +A forward proxy is an intermediate system that enables a browser to connect to a +remote network to which it normally does not have access. A forward proxy +can also be used to cache data, reducing load on the networks between the +forward proxy and the remote webserver.
+ +Apache's mod_proxy can be figured to behave like a forward proxy
+using the
A reverse proxy is a webserver system that is capable of serving webpages +sourced from other webservers - in addition to webpages on disk or generated +dynamically by CGI - making these pages look like they originated at the +reverse proxy.
+ +When configured with the mod_cache module the reverse +proxy can act as a cache for slower backend webservers. The reverse proxy +can also enable advanced URL strategies and management techniques, allowing +webpages served using different webserver systems or architectures to +coexist inside the same URL space. Reverse proxy systems are also ideal for +implementing centralised logging websites with many or diverse website +backends. Complex multi-tier webserver systems can be constructed using an +Apache mod_proxy frontend and any number of backend webservers.
+ +The reverse proxy is configured using the
+
You can control who can access your proxy via the normal
A
When configuring a reverse proxy, access control takes on the
+attributes of the normal server
You probably don't have that particular file type defined as +application/octet-stream in your proxy's mime.types configuration +file. A useful line can be
+ +In the rare situation where you must download a specific file using the FTP
+ASCII transfer method (while the default transfer is in
+binary mode), you can override mod_proxy's default by
+suffixing the request with ;type=a
to force an ASCII transfer.
+(FTP Directory listings are always executed in ASCII mode, however.)
+An FTP URI is interpreted relative to the home directory of the user +who is logging in. Alas, to reach higher directory levels you cannot +use /../, as the dots are interpreted by the browser and not actually +sent to the FTP server. To address this problem, the so called "Squid +%2f hack" was implemented in the Apache FTP proxy; it is is a solution +which is also used by other popular proxy servers like the Squid Proxy Cache. By +prepending /%2f to the path of your request, you can make such a proxy +change the FTP starting directory to / (instead of the home +directory).
+ +Example: To retrieve the file
+/etc/motd
, you would use the URL
+To log in to an FTP server by username and password, Apache +uses different strategies. +In absense of a user name and password in the URL altogether, +Apache sends an anomymous login to the FTP server, i.e.,
+This works for all popular FTP servers which are configured for +anonymous access.
+ +For a personal login with a specific username, you can embed
+the user name into the URL, like in:
+ftp://username@host/myfile
. If the FTP server
+asks for a password when given this username (which it should),
+then Apache will reply with a [401 Authorization required] response,
+which causes the Browser to pop up the username/password dialog.
+Upon entering the password, the connection attempt is retried,
+and if successful, the requested resource is presented.
+The advantage of this procedure is that your browser does not
+display the password in cleartext (which it would if you had used
+ftp://username:password@host/myfile
in
+the first place).
If you're using the
An Apache proxy server situated in an intranet needs to forward
+external requests through the company's firewall. However, when it has
+to access resources within the intranet, it can bypass the firewall
+when accessing hosts. The
Users within an intranet tend to omit the local domain name from their
+WWW requests, thus requesting "http://somehost/" instead of
+"http://somehost.my.dom.ain/". Some commercial proxy servers let them get
+away with this and simply serve the request, implying a configured
+local domain. When the
When enabled, this option will pass the Host: line from the +incoming request to the proxied host, instead of the hostname +specified in the proxypass line. +
+This option should normally be turned 'off'.
+This allows or prevents Apache from functioning as a forward proxy
+server. (Setting ProxyRequests to 'off' does not disable use of the
+
In a typical reverse proxy configuration, this option should be set to +'off'.
+This defines remote proxies to this proxy. match is either the +name of a URL-scheme that the remote server supports, or a partial URL +for which the remote server should be used, or '*' to indicate the +server should be contacted for all requests. remote-server is a +partial URL for the remote server. Syntax:
+ ++ remote-server = protocol://hostname[:port] ++ +
protocol is the protocol that should be used to communicate +with the remote server; only "http" is supported by this module.
+ ++Example:
+In the last example, the proxy will forward FTP requests, encapsulated +as yet another HTTP proxy request, to another proxy which can handle +them.
+ +This option also supports reverse proxy configuration - a backend +webserver can be embedded within a virtualhost URL space even if that +server is hidden by another forward proxy.
+This directive allows remote servers to be mapped into the space of +the local server; the local server does not act as a proxy in the +conventional sense, but appears to be a mirror of the remote +server. path is the name of a local virtual path; +url is a partial URL for the remote server.
+ +Suppose the local server has address http://wibble.org/
;
+then
will cause a local request for the
+<http://wibble.org/mirror/foo/bar
> to be
+internally converted into a proxy request to
+<http://foo.com/bar
>.
+The ! directive is useful in situations where you don't want to reverse-proxy +a subdirectory. eg.
+will proxy all requests to /mirror/foo to foo.com EXCEPT requests made to /mirror/foo/i
+ +This directive lets Apache adjust the URL in the Location
,
+Content-Location
and URI
headers on
+HTTP redirect responses. This is essential when Apache is used as
+a reverse proxy to avoid by-passing the reverse proxy because of HTTP
+redirects on the backend servers which stay behind the reverse proxy.
path is the name of a local virtual path.
+url is a partial URL for the remote server - the same way they are
+used for the
+Example:
+Suppose the local server has address http://wibble.org/
; then
will not only cause a local request for the
+<http://wibble.org/mirror/foo/bar
> to be internally
+converted into a proxy request to <http://foo.com/bar
> (the
+functionality ProxyPass
provides here). It also takes care of
+redirects the server foo.com sends: when http://foo.com/bar
is
+redirected by him to http://foo.com/quux
Apache adjusts this to
+http://wibble.org/mirror/foo/quux
before forwarding the HTTP
+redirect response to the client.
+Note that this RewriteRule ... [P]
") from
+
The CONNECT
method may
+connect. Today's browsers use this method when a https
+connection is requested and proxy tunneling over http is in
+effect.
By default, only the default https port (443) and the
+default snews port (563) are enabled. Use the
+
The
'rocky.wotsamattau.edu' would also be matched if referenced by IP +address.
+ +Note that 'wotsamattau' would also be sufficient to match +'wotsamattau.edu'.
+ +Note also that
+ +blocks connections to all sites.
+ +The
The
This directive is only useful for Apache proxy servers within
+intranets. The
The arguments to the NoProxy directive are one of the following type list:
+.com
.apache.org.
.MyDomain.com
and
+ .mydomain.com.
(note the trailing period) are
+ considered equal. Since a domain comparison does not involve a DNS
+ lookup, it is much more efficient than subnet comparison.192.168
or 192.168.0.0
255.255.0.0
)192.168.112.0/21
192.168.112.0/21
with a netmask of 21
+ valid bits (also used in the form 255.255.248.0)prep.ai.mit.edu
+ www.apache.org.
WWW.MyDomain.com
+ and www.mydomain.com.
(note the trailing period) are
+ considered equal.This directive allows a user to specifiy a timeout on proxy requests. +This is usefull when you have a slow/buggy appserver which hangs, +and you would rather just return a timeout and fail gracefully instead +of waiting however long it takes the server to return +
+This directive is only useful for Apache proxy servers within
+intranets. The
This directive controls the use of the Via:
HTTP
+header by the proxy. Its intended use is to control the flow of of
+proxy requests along a chain of proxy servers. See RFC2068 (HTTP/1.1)
+for an explanation of Via:
header lines.
Via:
header,
+it is passed through unchanged.Via:
header line added for
+the current host.Via:
header
+line will additionally have the Apache server version shown as a
+Via:
comment field.Via:
header lines
+removed. No new Via:
header will be generated.This directive is useful for reverse-proxy setups, where you want to +have a common look and feel on the error pages seen by the end user. +This also allows for included files (via mod_include's SSI) to get +the error code and act accordingly (default behavior would display +the error page of the proxied server, turning this on shows the SSI +Error message).
++ ``The great thing about mod_rewrite is it gives you + all the configurability and flexibility of Sendmail. + The downside to mod_rewrite is that it gives you all + the configurability and flexibility of Sendmail.'' + + ++ ++ -- Brian Behlendorf+
+ Apache Group +
+ `` Despite the tons of examples and docs, + mod_rewrite is voodoo. Damned cool voodoo, but still + voodoo. '' + ++ + ++ -- Brian Moore+
+ bem@news.cmc.net +
Welcome to mod_rewrite, the Swiss Army Knife of URL + manipulation!
+ +This module uses a rule-based rewriting engine (based on a + regular-expression parser) to rewrite requested URLs on the + fly. It supports an unlimited number of rules and an + unlimited number of attached rule conditions for each rule to + provide a really flexible and powerful URL manipulation + mechanism. The URL manipulations can depend on various tests, + for instance server variables, environment variables, HTTP + headers, time stamps and even external database lookups in + various formats can be used to achieve a really granular URL + matching.
+ +This module operates on the full URLs (including the
+ path-info part) both in per-server context
+ (httpd.conf
) and per-directory context
+ (.htaccess
) and can even generate query-string
+ parts on result. The rewritten result can lead to internal
+ sub-processing, external request redirection or even to an
+ internal proxy throughput.
But all this functionality and flexibility has its + drawback: complexity. So don't expect to understand this + entire module in just one day.
+ +This module was invented and originally written in April + 1996 and gifted exclusively to the The Apache Group in July 1997 + by
+ +++Ralf S. + Engelschall
+rse@engelschall.com
+www.engelschall.com
+
The internal processing of this module is very complex but + needs to be explained once even to the average user to avoid + common mistakes and to let you exploit its full + functionality.
+ +First you have to understand that when Apache processes a
+ HTTP request it does this in phases. A hook for each of these
+ phases is provided by the Apache API. Mod_rewrite uses two of
+ these hooks: the URL-to-filename translation hook which is
+ used after the HTTP request has been read but before any
+ authorization starts and the Fixup hook which is triggered
+ after the authorization phases and after the per-directory
+ config files (.htaccess
) have been read, but
+ before the content handler is activated.
So, after a request comes in and Apache has determined the + corresponding server (or virtual server) the rewriting engine + starts processing of all mod_rewrite directives from the + per-server configuration in the URL-to-filename phase. A few + steps later when the final data directories are found, the + per-directory configuration directives of mod_rewrite are + triggered in the Fixup phase. In both situations mod_rewrite + rewrites URLs either to new URLs or to filenames, although + there is no obvious distinction between them. This is a usage + of the API which was not intended to be this way when the API + was designed, but as of Apache 1.x this is the only way + mod_rewrite can operate. To make this point more clear + remember the following two points:
+ +.htaccess
files, although these are reached
+ a very long time after the URLs have been translated to
+ filenames. It has to be this way because
+ .htaccess
files live in the filesystem, so
+ processing has already reached this stage. In other
+ words: According to the API phases at this time it is too
+ late for any URL manipulations. To overcome this chicken
+ and egg problem mod_rewrite uses a trick: When you
+ manipulate a URL/filename in per-directory context
+ mod_rewrite first rewrites the filename back to its
+ corresponding URL (which is usually impossible, but see
+ the RewriteBase
directive below for the
+ trick to achieve this) and then initiates a new internal
+ sub-request with the new URL. This restarts processing of
+ the API phases.
+
+ Again mod_rewrite tries hard to make this complicated + step totally transparent to the user, but you should + remember here: While URL manipulations in per-server + context are really fast and efficient, per-directory + rewrites are slow and inefficient due to this chicken and + egg problem. But on the other hand this is the only way + mod_rewrite can provide (locally restricted) URL + manipulations to the average user.
+Don't forget these two points!
+Now when mod_rewrite is triggered in these two API phases, it + reads the configured rulesets from its configuration + structure (which itself was either created on startup for + per-server context or during the directory walk of the Apache + kernel for per-directory context). Then the URL rewriting + engine is started with the contained ruleset (one or more + rules together with their conditions). The operation of the + URL rewriting engine itself is exactly the same for both + configuration contexts. Only the final result processing is + different.
+ +The order of rules in the ruleset is important because the
+ rewriting engine processes them in a special (and not very
+ obvious) order. The rule is this: The rewriting engine loops
+ through the ruleset rule by rule (RewriteCond
+ directives). For historical reasons the conditions are given
+ first, and so the control flow is a little bit long-winded. See
+ Figure 1 for more details.
![]() |
+
Figure 1: The + control flow through the rewriting ruleset | +
As you can see, first the URL is matched against the + Pattern of each rule. When it fails mod_rewrite + immediately stops processing this rule and continues with the + next rule. If the Pattern matches, mod_rewrite looks + for corresponding rule conditions. If none are present, it + just substitutes the URL with a new value which is + constructed from the string Substitution and goes on + with its rule-looping. But if conditions exist, it starts an + inner loop for processing them in the order that they are + listed. For conditions the logic is different: we don't match + a pattern against the current URL. Instead we first create a + string TestString by expanding variables, + back-references, map lookups, etc. and then we try + to match CondPattern against it. If the pattern + doesn't match, the complete set of conditions and the + corresponding rule fails. If the pattern matches, then the + next condition is processed until no more conditions are + available. If all conditions match, processing is continued + with the substitution of the URL with + Substitution.
+ +As of Apache 1.3.20, special characters in
+ TestString and Substitution strings can be
+ escaped (that is, treated as normal characters without their
+ usual special meaning) by prefixing them with a slosh ('\')
+ character. In other words, you can include an actual
+ dollar-sign character in a Substitution string by
+ using '\$
'; this keeps mod_rewrite from trying
+ to treat it as a backreference.
One important thing here has to be remembered: Whenever you
+ use parentheses in Pattern or in one of the
+ CondPattern, back-references are internally created
+ which can be used with the strings $N
and
+ %N
(see below). These are available for creating
+ the strings Substitution and TestString.
+ Figure 2 shows to which locations the back-references are
+ transfered for expansion.
![]() |
+
Figure 2: The + back-reference flow through a rule | +
We know this was a crash course on mod_rewrite's internal + processing. But you will benefit from this knowledge when + reading the following documentation of the available + directives.
+ +This module keeps track of two additional (non-standard)
+ CGI/SSI environment variables named SCRIPT_URL
+ and SCRIPT_URI
. These contain the
+ logical Web-view to the current resource, while the
+ standard CGI/SSI variables SCRIPT_NAME
and
+ SCRIPT_FILENAME
contain the physical
+ System-view.
Notice: These variables hold the URI/URL as they were + initially requested, i.e., before any + rewriting. This is important because the rewriting process is + primarily used to rewrite logical URLs to physical + pathnames.
+ +Example:
+ ++SCRIPT_NAME=/sw/lib/w3s/tree/global/u/rse/.www/index.html +SCRIPT_FILENAME=/u/rse/.www/index.html +SCRIPT_URL=/u/rse/ +SCRIPT_URI=http://en1.engelschall.com/u/rse/ ++
We also have an URL + Rewriting Guide available, which provides a collection of + practical solutions for URL-based problems. There you can + find real-life rulesets and additional information about + mod_rewrite.
+The off
this module does no runtime processing at
+ all. It does not even update the SCRIPT_URx
+ environment variables.
Use this directive to disable the module instead of
+ commenting out all the
Note that, by default, rewrite configurations are not
+ inherited. This means that you need to have a
+ RewriteEngine on
directive for each virtual host
+ in which you wish to use it.
The
inherit
'.htaccess
configuration are inherited.The /
') then it is assumed to be relative to the
+ Server Root. The directive should occur only once per
+ server config.
/dev/null
, because
+ although the rewriting engine does not then output to a
+ logfile it still creates the logfile output internally.
+ This will slow down the server with no advantage
+ to the administrator! To disable logging either
+ remove or comment out the RewriteLogLevel 0
!
+The
To disable the logging of rewriting actions simply set + Level to 0. This disables all rewrite action + logs.
+ +This directive sets the filename for a synchronization
+ lockfile which mod_rewrite needs to communicate with
The
The MapName is + the name of the map and will be used to specify a + mapping-function for the substitution strings of a rewriting + rule via one of the following constructs:
+ +++ +${
MapName:
+ LookupKey}
+${
MapName:
+ LookupKey|
DefaultValue +}
+
When such a construct occurs the map MapName is + consulted and the key LookupKey is looked-up. If the + key is found, the map-function construct is substituted by + SubstValue. If the key is not found then it is + substituted by DefaultValue or by the empty string + if no DefaultValue was specified.
+ +The following combinations for MapType and + MapSource can be used:
+ +txt
, MapSource: Unix filesystem
+ path to valid regular file
+
+ This is the standard rewriting map feature where the + MapSource is a plain ASCII file containing + either blank lines, comment lines (starting with a '#' + character) or pairs like the following - one per + line.
+ ++ MatchingKey + SubstValue ++ +
+## +## map.txt -- rewriting map +## + +Ralf.S.Engelschall rse # Bastard Operator From Hell +Mr.Joe.Average joe # Mr. Average ++
rnd
, MapSource: Unix filesystem
+ path to valid regular file
+
+ This is identical to the Standard Plain Text variant
+ above but with a special post-processing feature: After
+ looking up a value it is parsed according to contained
+ ``|
'' characters which have the meaning of
+ ``or''. In other words they indicate a set of
+ alternatives from which the actual returned value is
+ chosen randomly. Although this sounds crazy and useless,
+ it was actually designed for load balancing in a reverse
+ proxy situation where the looked up values are server
+ names. Example:
+## +## map.txt -- rewriting map +## + +static www1|www2|www3|www4 +dynamic www5|www6 ++
dbm
, MapSource: Unix filesystem
+ path to valid regular file
+
+ Here the source is a binary NDBM format file + containing the same contents as a Plain Text + format file, but in a special representation which is + optimized for really fast lookups. You can create such a + file with any NDBM tool or with the following Perl + script:
+ ++#!/path/to/bin/perl +## +## txt2dbm -- convert txt map to dbm format +## + +use NDBM_File; +use Fcntl; + +($txtmap, $dbmmap) = @ARGV; + +open(TXT, "<$txtmap") or die "Couldn't open $txtmap!\n"; +tie (%DB, 'NDBM_File', $dbmmap,O_RDWR|O_TRUNC|O_CREAT, 0644) or die "Couldn't create $dbmmap!\n"; + +while (<TXT>) { + next if (/^\s*#/ or /^\s*$/); + $DB{$1} = $2 if (/^\s*(\S+)\s+(\S+)/); +} + +untie %DB; +close(TXT); ++
int
, MapSource: Internal Apache
+ function
+
+ Here the source is an internal Apache function. + Currently you cannot create your own, but the following + functions already exists:
+ +prg
, MapSource: Unix filesystem
+ path to valid regular file
+
+ Here the source is a program, not a map file. To
+ create it you can use the language of your choice, but
+ the result has to be a executable (i.e., either
+ object-code or a script with the magic cookie trick
+ '#!/path/to/interpreter
' as the first
+ line).
This program is started once at startup of the Apache
+ servers and then communicates with the rewriting engine
+ over its stdin
and stdout
+ file-handles. For each map-function lookup it will
+ receive the key to lookup as a newline-terminated string
+ on stdin
. It then has to give back the
+ looked-up value as a newline-terminated string on
+ stdout
or the four-character string
+ ``NULL
'' if it fails (i.e., there
+ is no corresponding value for the given key). A trivial
+ program which will implement a 1:1 map (i.e.,
+ key == value) could be:
+#!/usr/bin/perl +$| = 1; +while (<STDIN>) { + # ...put here any transformations or lookups... + print $_; +} ++
But be very careful:
+ +stdout
! This will cause a deadloop! Hence
+ the ``$|=1
'' in the above example...mtime
of the
+mapfile changes or the server does a restart. This way you can have
+map-functions in rules which are used for every
+request. This is no problem, because the external lookup only happens
+once!
+The .htaccess
). There it will act locally,
+ i.e., the local directory prefix is stripped at this
+ stage of processing and your rewriting rules act only on the
+ remainder. At the end it is automatically added back to the
+ path.
When a substitution occurs for a new URL, this module has
+ to re-inject the URL into the server processing. To be able
+ to do this it needs to know what the corresponding URL-prefix
+ or URL-base is. By default this prefix is the corresponding
+ filepath itself. But at most websites URLs are NOT
+ directly related to physical filename paths, so this
+ assumption will usually be wrong! There you have to
+ use the RewriteBase
directive to specify the
+ correct URL-prefix.
.htaccess
+files where you want to use For example, assume the following per-directory config file:
+ ++# +# /abc/def/.htaccess -- per-dir config file for directory /abc/def +# Remember: /abc/def is the physical path of /xyz, i.e., the server +# has a 'Alias /xyz /abc/def' directive e.g. +# + +RewriteEngine On + +# let the server know that we were reached via /xyz and not +# via the physical path prefix /abc/def +RewriteBase /xyz + +# now the rewriting rules +RewriteRule ^oldstuff\.html$ newstuff.html ++
In the above example, a request to
+ /xyz/oldstuff.html
gets correctly rewritten to
+ the physical file /abc/def/newstuff.html
.
The following list gives detailed information about + the internal processing steps:
++Request: + /xyz/oldstuff.html + +Internal Processing: + /xyz/oldstuff.html -> /abc/def/oldstuff.html (per-server Alias) + /abc/def/oldstuff.html -> /abc/def/newstuff.html (per-dir RewriteRule) + /abc/def/newstuff.html -> /xyz/newstuff.html (per-dir RewriteBase) + /xyz/newstuff.html -> /abc/def/newstuff.html (per-server Alias) + +Result: + /abc/def/newstuff.html + ++
This seems very complicated but is + the correct Apache internal processing, because the + per-directory rewriting comes too late in the + process. So, when it occurs the (rewritten) request + has to be re-injected into the Apache kernel! BUT: + While this seems like a serious overhead, it really + isn't, because this re-injection happens fully + internally to the Apache server and the same + procedure is used by many other operations inside + Apache. So, you can be sure the design and + implementation is correct.
+The
TestString is a string which can contains the + following expanded constructs in addition to plain text:
+ +
+ $N
+
+ (0 <= N <= 9) which provide access to the grouped
+ parts (parenthesis!) of the pattern from the
+ corresponding RewriteRule
directive (the one
+ following the current bunch of RewriteCond
+ directives).
+
+ %N
+
+ (1 <= N <= 9) which provide access to the grouped
+ parts (parentheses!) of the pattern from the last matched
+ RewriteCond
directive in the current bunch
+ of conditions.
+
+ ${mapname:key|default}
+
+ See the documentation for
+ RewriteMap for more details.
+ ++ where NAME_OF_VARIABLE can be a string taken + from the following list: + +%{
NAME_OF_VARIABLE +}
+
+ HTTP headers:
+
+ HTTP_USER_AGENT |
+
+
+ connection & request:
+
+ REMOTE_ADDR |
+ |
+ server internals:
+
+ DOCUMENT_ROOT |
+
+
+ system stuff:
+
+ TIME_YEAR |
+
+
+ specials:
+
+ API_VERSION |
+
These variables all
+ correspond to the similarly named HTTP
+ MIME-headers, C variables of the Apache server or
+ struct tm
fields of the Unix system.
+ Most are documented elsewhere in the Manual or in
+ the CGI specification. Those that are special to
+ mod_rewrite include:
IS_SUBREQ
API_VERSION
THE_REQUEST
GET
+ /index.html HTTP/1.1
"). This does not
+ include any additional headers sent by the
+ browser.REQUEST_URI
REQUEST_FILENAME
Special Notes:
+ +filename
field of the internal
+ request_rec
structure of the Apache server.
+ The first name is just the commonly known CGI variable name
+ while the second is the consistent counterpart to
+ REQUEST_URI (which contains the value of the
+ uri
field of request_rec
).%{ENV:variable}
where variable can be
+ any environment variable. This is looked-up via internal
+ Apache structures and (if not found there) via
+ getenv()
from the Apache server process.%{HTTP:header}
where header can be
+ any HTTP MIME-header name. This is looked-up from the HTTP
+ request. Example: %{HTTP:Proxy-Connection}
is
+ the value of the HTTP header
+ ``Proxy-Connection:
''.%{LA-U:variable}
for look-aheads which perform
+ an internal (URL-based) sub-request to determine the final
+ value of variable. Use this when you want to use a
+ variable for rewriting which is actually set later in an
+ API phase and thus is not available at the current stage.
+ For instance when you want to rewrite according to the
+ REMOTE_USER
variable from within the
+ per-server context (httpd.conf
file) you have
+ to use %{LA-U:REMOTE_USER}
because this
+ variable is set by the authorization phases which come
+ after the URL translation phase where mod_rewrite
+ operates. On the other hand, because mod_rewrite implements
+ its per-directory context (.htaccess
file) via
+ the Fixup phase of the API and because the authorization
+ phases come before this phase, you just can use
+ %{REMOTE_USER}
there.%{LA-F:variable}
which performs an internal
+ (filename-based) sub-request to determine the final value
+ of variable. Most of the time this is the same as
+ LA-U above.CondPattern is the condition pattern, + i.e., a regular expression which is applied to the + current instance of the TestString, i.e., + TestString is evaluated and then matched against + CondPattern.
+ +Remember: CondPattern is a + standard Extended Regular Expression with some + additions:
+ +!
' character (exclamation mark) to specify a
+ non-matching pattern.Additionally you can set special flags for + CondPattern by appending
+ +++ as the third argument to the[
flags]
+
RewriteCond
+ directive. Flags is a comma-separated list of the
+ following flags:
+
+ nocase|NC
'
+ (no case)ornext|OR
'
+ (or next condition)+RewriteCond %{REMOTE_HOST} ^host1.* [OR] +RewriteCond %{REMOTE_HOST} ^host2.* [OR] +RewriteCond %{REMOTE_HOST} ^host3.* +RewriteRule ...some special stuff for any of these hosts... ++
Example:
+ +To rewrite the Homepage of a site according to the
+ ``User-Agent:
'' header of the request, you can
+ use the following:
+RewriteCond %{HTTP_USER_AGENT} ^Mozilla.* +RewriteRule ^/$ /homepage.max.html [L] + +RewriteCond %{HTTP_USER_AGENT} ^Lynx.* +RewriteRule ^/$ /homepage.min.html [L] + +RewriteRule ^/$ /homepage.std.html [L] ++
Interpretation: If you use Netscape Navigator as your + browser (which identifies itself as 'Mozilla'), then you + get the max homepage, which includes Frames, etc. + If you use the Lynx browser (which is Terminal-based), then + you get the min homepage, which contains no images, no + tables, etc. If you use any other browser you get + the standard homepage.
+ +The
Pattern can + be (for Apache 1.1.x a System V8 and for Apache 1.2.x and + later a POSIX) regular + expression which gets applied to the current URL. Here + ``current'' means the value of the URL when this rule gets + applied. This may not be the originally requested URL, + because any number of rules may already have matched and made + alterations to it.
+ +Some hints about the syntax of regular expressions:
+ +
++Text: ++ |
+
For more information about regular expressions either have
+ a look at your local regex(3) manpage or its
+ src/regex/regex.3
copy in the Apache 1.3
+ distribution. If you are interested in more detailed
+ information about regular expressions and their variants
+ (POSIX regex, Perl regex, etc.) have a look at the
+ following dedicated book on this topic:
+ Mastering Regular Expressions+ +
+ Jeffrey E.F. Friedl
+ Nutshell Handbook Series
+ O'Reilly & Associates, Inc. 1997
+ ISBN 1-56592-257-3
+
Additionally in mod_rewrite the NOT character
+ ('!
') is a possible pattern prefix. This gives
+ you the ability to negate a pattern; to say, for instance:
+ ``if the current URL does NOT match this
+ pattern''. This can be used for exceptional cases, where
+ it is easier to match the negative pattern, or as a last
+ default rule.
$N
in the substitution
+ string!
+Substitution of a + rewriting rule is the string which is substituted for (or + replaces) the original URL for which Pattern + matched. Beside plain text you can use
+ +$N
to the RewriteRule
+ pattern%N
to the last matched
+ RewriteCond pattern%{VARNAME}
)${mapname:key|default}
)$
N
+ (N=0..9) identifiers which will be replaced
+ by the contents of the Nth group of the
+ matched Pattern. The server-variables are the same
+ as for the TestString of a RewriteCond
+ directive. The mapping-functions come from the
+ RewriteMap
directive and are explained there.
+ These three types of variables are expanded in the order of
+ the above list.
+
+ As already mentioned above, all the rewriting rules are
+ applied to the Substitution (in the order of
+ definition in the config file). The URL is completely
+ replaced by the Substitution and the
+ rewriting process goes on until there are no more rules
+ unless explicitly terminated by a
+ L
flag - see below.
There is a special substitution string named
+ '-
' which means: NO
+ substitution! Sounds silly? No, it is useful to
+ provide rewriting rules which only match
+ some URLs but do no substitution, e.g., in
+ conjunction with the C (chain) flag to be
+ able to have more than one pattern to be applied before a
+ substitution occurs.
One more note: You can even create URLs in the + substitution string containing a query string part. Just use + a question mark inside the substitution string to indicate + that the following stuff should be re-injected into the + QUERY_STRING. When you want to erase an existing query + string, end the substitution string with just the question + mark.
+ +http://
thishost[:thisport]
+ then mod_rewrite automatically strips it
+ out. This auto-reduction on implicit external redirect
+ URLs is a useful and important feature when used in
+ combination with a mapping-function which generates the
+ hostname part. Have a look at the first example in the
+ example section below to understand this.
+http://thishost
because of this feature. To
+ achieve such a self-redirect, you have to use the
+ R-flag (see below).
+Additionally you can set special flags for + Substitution by appending
+ +++ as the third argument to the[
flags]
+
RewriteRule
+ directive. Flags is a comma-separated list of the
+ following flags:
+
+ redirect|R
+ [=code]' (force redirect)http://thishost[:thisport]/
(which makes the
+ new URL a URI) to force a external redirection. If no
+ code is given a HTTP response of 302 (MOVED
+ TEMPORARILY) is used. If you want to use other response
+ codes in the range 300-400 just specify them as a number
+ or use one of the following symbolic names:
+ temp
(default), permanent
,
+ seeother
. Use it for rules which should
+ canonicalize the URL and give it back to the client,
+ e.g., translate ``/~
'' into
+ ``/u/
'' or always append a slash to
+ /u/
user, etc.Note: When you use this flag, make
+ sure that the substitution field is a valid URL! If not,
+ you are redirecting to an invalid location! And remember
+ that this flag itself only prefixes the URL with
+ http://thishost[:thisport]/
, rewriting
+ continues. Usually you also want to stop and do the
+ redirection immediately. To stop the rewriting you also
+ have to provide the 'L' flag.
forbidden|F
' (force URL
+ to be forbidden)gone|G
' (force URL to be
+ gone)proxy|P
' (force
+ proxy)http://
hostname) which can be
+ handled by the Apache proxy module. If not you get an
+ error from the proxy module. Use this flag to achieve a
+ more powerful implementation of the ProxyPass directive,
+ to map some remote stuff into the namespace of the local
+ server.
+
+ Notice: To use this functionality make sure you have
+ the proxy module compiled into your Apache server
+ program. If you don't know please check whether
+ mod_proxy.c
is part of the ``httpd
+ -l
'' output. If yes, this functionality is
+ available to mod_rewrite. If not, then you first have to
+ rebuild the ``httpd
'' program with mod_proxy
+ enabled.
last|L
'
+ (last rule)last
command or the break
command
+ from the C language. Use this flag to prevent the currently
+ rewritten URL from being rewritten further by following
+ rules. For example, use it to rewrite the root-path URL
+ ('/
') to a real one, e.g.,
+ '/e/www/
'.next|N
'
+ (next round)next
command or
+ the continue
command from the C language. Use
+ this flag to restart the rewriting process, i.e.,
+ to immediately go to the top of the loop.chain|C
'
+ (chained with next rule).www
'' part inside a per-directory rule set
+ when you let an external redirect happen (where the
+ ``.www
'' part should not to occur!).type|T
=MIME-type'
+ (force MIME type)mod_alias
directive
+ ScriptAlias
which internally forces all files
+ inside the mapped directory to have a MIME type of
+ ``application/x-httpd-cgi
''.nosubreq|NS
' (used only if
+ no internal
+ sub-request)mod_include
tries to find out
+ information about possible directory default files
+ (index.xxx
). On sub-requests it is not
+ always useful and even sometimes causes a failure to if
+ the complete set of rules are applied. Use this flag to
+ exclude some rules.Use the following rule for your decision: whenever you + prefix some URLs with CGI-scripts to force them to be + processed by the CGI-script, the chance is high that you + will run into problems (or even overhead) on + sub-requests. In these cases, use this flag.
+nocase|NC
'
+ (no case)qsappend|QSA
'
+ (query string
+ append)noescape|NE
'
+ (no URI escaping of
+ output)/foo/zed
' into a safe
+ request for '/bar?arg=P1=zed
'.
+ passthrough|PT
'
+ (pass through to next
+ handler)uri
field of the internal
+ request_rec
structure to the value of the
+ filename
field. This flag is just a hack to
+ be able to post-process the output of
+ RewriteRule
directives by
+ Alias
, ScriptAlias
,
+ Redirect
, etc. directives from
+ other URI-to-filename translators. A trivial example to
+ show the semantics: If you want to rewrite
+ /abc
to /def
via the rewriting
+ engine of mod_rewrite
and then
+ /def
to /ghi
with
+ mod_alias
:
+PT
flag then
+ mod_rewrite
will do its job fine,
+ i.e., it rewrites uri=/abc/...
to
+ filename=/def/...
as a full API-compliant
+ URI-to-filename translator should do. Then
+ mod_alias
comes and tries to do a
+ URI-to-filename transition which will not work.
+
+ Note: You have to use this flag if you want to
+ intermix directives of different modules which contain
+ URL-to-filename translators. The typical example
+ is the use of mod_alias
and
+ mod_rewrite
..
skip|S
=num'
+ (skip next rule(s))skip=N
where N is the number of rules in the
+ else-clause. (This is not the same as the
+ 'chain|C' flag!)env|E=
VAR:VAL'
+ (set environment variable)$N
and
+ %N
which will be expanded. You can use this
+ flag more than once to set more than one variable. The
+ variables can be later dereferenced in many situations, but
+ usually from within XSSI (via <!--#echo
+ var="VAR"-->
) or CGI (e.g.
+ $ENV{'VAR'}
). Additionally you can dereference
+ it in a following RewriteCond pattern via
+ %{ENV:VAR}
. Use this to strip but remember
+ information from URLs.There is one exception: If a substitution string
+ starts with ``http://
'' then the directory
+ prefix will not be added and an
+ external redirect or proxy throughput (if flag
+ P is used!) is forced!
RewriteEngine On
'' in these files
+ and ``Options
+ FollowSymLinks
'' must be enabled. If your
+ administrator has disabled override of
+ FollowSymLinks
for a user's directory, then
+ you cannot use the rewriting engine. This restriction is
+ needed for security reasons.
+Here are all possible substitution combinations and their + meanings:
+ +Inside per-server configuration
+ (httpd.conf
)
+ for request ``GET
+ /somepath/pathinfo
'':
+
++Given Rule Resulting Substitution +---------------------------------------------- ---------------------------------- +^/somepath(.*) otherpath$1 not supported, because invalid! + +^/somepath(.*) otherpath$1 [R] not supported, because invalid! + +^/somepath(.*) otherpath$1 [P] not supported, because invalid! +---------------------------------------------- ---------------------------------- +^/somepath(.*) /otherpath$1 /otherpath/pathinfo + +^/somepath(.*) /otherpath$1 [R] http://thishost/otherpath/pathinfo + via external redirection + +^/somepath(.*) /otherpath$1 [P] not supported, because silly! +---------------------------------------------- ---------------------------------- +^/somepath(.*) http://thishost/otherpath$1 /otherpath/pathinfo + +^/somepath(.*) http://thishost/otherpath$1 [R] http://thishost/otherpath/pathinfo + via external redirection + +^/somepath(.*) http://thishost/otherpath$1 [P] not supported, because silly! +---------------------------------------------- ---------------------------------- +^/somepath(.*) http://otherhost/otherpath$1 http://otherhost/otherpath/pathinfo + via external redirection + +^/somepath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo + via external redirection + (the [R] flag is redundant) + +^/somepath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo + via internal proxy ++ |
+
Inside per-directory configuration for
+ /somepath
+ (i.e., file .htaccess
in dir
+ /physical/path/to/somepath
containing
+ RewriteBase /somepath
)
+ for request ``GET
+ /somepath/localpath/pathinfo
'':
+
++Given Rule Resulting Substitution +---------------------------------------------- ---------------------------------- +^localpath(.*) otherpath$1 /somepath/otherpath/pathinfo + +^localpath(.*) otherpath$1 [R] http://thishost/somepath/otherpath/pathinfo + via external redirection + +^localpath(.*) otherpath$1 [P] not supported, because silly! +---------------------------------------------- ---------------------------------- +^localpath(.*) /otherpath$1 /otherpath/pathinfo + +^localpath(.*) /otherpath$1 [R] http://thishost/otherpath/pathinfo + via external redirection + +^localpath(.*) /otherpath$1 [P] not supported, because silly! +---------------------------------------------- ---------------------------------- +^localpath(.*) http://thishost/otherpath$1 /otherpath/pathinfo + +^localpath(.*) http://thishost/otherpath$1 [R] http://thishost/otherpath/pathinfo + via external redirection + +^localpath(.*) http://thishost/otherpath$1 [P] not supported, because silly! +---------------------------------------------- ---------------------------------- +^localpath(.*) http://otherhost/otherpath$1 http://otherhost/otherpath/pathinfo + via external redirection + +^localpath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo + via external redirection + (the [R] flag is redundant) + +^localpath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo + via internal proxy ++ |
+
Example:
+ +We want to rewrite URLs of the form
+ +++ into + +/
Language/~
+ Realname/.../
File +
++ +/u/
Username/.../
+ File.
Language +
We take the rewrite mapfile from above and save it under
+ /path/to/file/map.txt
. Then we only have to
+ add the following lines to the Apache server configuration
+ file:
+RewriteLog /path/to/file/rewrite.log +RewriteMap real-to-user txt:/path/to/file/map.txt +RewriteRule ^/([^/]+)/~([^/]+)/(.*)$ /u/${real-to-user:$2|nobody}/$3.$1 ++
The
The directives are considered in the order they appear in
+ the configuration files. So more complex sequences can be used,
+ such as this example, which sets netscape
if the
+ browser is mozilla but not MSIE.
The User-Agent
HTTP
+ request header field. The first argument should be a POSIX.2
+ extended regular expression (similar to an
+ egrep
-style regex). The rest of the arguments give
+ the names of variables to set, and optionally values to which they
+ should be set. These take the form of
varname
, or!varname
, orvarname=value
In the first form, the value will be set to "1". The second
+ will remove the given variable if already defined, and the
+ third will set the variable to the value given by
+ value
. If a User-Agent
+ string matches more than one entry, they will be merged.
+ Entries are processed in the order in which they appear, and
+ later entries can override earlier ones.
For example:
+Note that the regular expression string is
+ case-sensitive. For case-INsensitive matching,
+ see the
The
The
The
The
Remote_Host
- the hostname (if available) of
+ the client making the requestRemote_Addr
- the IP address of the client
+ making the requestRemote_User
- the authenticated username (if
+ available)Request_Method
- the name of the method
+ being used (GET
, POST
, et
+ cetera)Request_Protocol
- the name and version of
+ the protocol with which the request was made (e.g.,
+ "HTTP/0.9", "HTTP/1.1", etc.)Request_URI
- the portion of the URL
+ following the scheme and host portionSome of the more commonly used request header field names
+ include Host
, User-Agent
, and
+ Referer
.
If the attribute name doesn't match any of the
+ special keywords, nor any of the request's header field names,
+ it is tested as the name of an environment variable in the list
+ of those associated with the request. This allows
+
SetEnvIf[NoCase]
directives are available for
+ testing in this manner. 'Earlier' means that they were
+ defined at a broader scope (such as server-wide) or
+ previously in the current directive's scope.
+attribute may be a regular expression when used to + match a request header. If attribute is a regular + expression and it doesn't match any of the request's header + names, then attribute is not tested against the + request's environment variable list.
+ +The first three will set the environment variable
+ object_is_image
if the request was for an image
+ file, and the fourth sets intra_site_referral
if
+ the referring page was somewhere on the
+ www.mydomain.com
Web site.
The last example will set environment variable
+ HAVE_TS
if the request contains any headers that
+ begin with "TS" whose values begins with any character in the
+ set [a-z].
The
This will cause the site
environment variable
+ to be set to "apache
" if the HTTP request header
+ field Host:
was included and contained
+ Apache.Org
, apache.org
, or any other
+ combination.
On selected operating systems this module can be used to + load modules into Apache at runtime via the Dynamic Shared Object (DSO) mechanism, + rather than requiring a recompilation.
+ +On Unix, the loaded code typically comes from shared object + files (usually with .so extension), on Windows + this may either the .so or .dll + extension. This module is only available in Apache 1.3 and + up.
+ +In previous releases, the functionality of this module was + provided for Unix by mod_dld, and for Windows by mod_dll. On + Windows, mod_dll was used in beta release 1.3b1 through 1.3b5. + mod_so combines these two modules into a single module for all + operating systems.
+ +Warning: Apache 1.3 modules cannot be directly used + with Apache 2.0 - the module must be modified to dynamically + load or compile into Apache 2.0.
+The Apache module API is unchanged between the Unix and + Windows versions. Many modules will run on Windows with no or + little change from Unix, although others rely on aspects of the + Unix architecture which are not present in Windows, and will + not work.
+ +When a module does work, it can be added to the server in
+ one of two ways. As with Unix, it can be compiled into the
+ server. Because Apache for Windows does not have the
+ Configure
program of Apache for Unix, the module's
+ source file must be added to the ApacheCore project file, and
+ its symbols must be added to the
+ os\win32\modules.c
file.
The second way is to compile the module as a DLL, a shared
+ library that can be loaded into the server at runtime, using
+ the
+ directive. These module DLLs can be distributed and run on any
+ Apache for Windows installation, without recompilation of the
+ server.
To create a module DLL, a small change is necessary to the
+ module's source file: The module record must be exported from
+ the DLL (which will be created later; see below). To do this,
+ add the AP_MODULE_DECLARE_DATA
(defined in the
+ Apache header files) to your module's module record definition.
+ For example, if your module has:
Replace the above with:
+Note that this will only be activated on Windows, so the
+ module can continue to be used, unchanged, with Unix if needed.
+ Also, if you are familiar with .DEF
files, you can
+ export the module record with that method instead.
Now, create a DLL containing your module. You will need to + link this against the libhttpd.lib export library that is + created when the libhttpd.dll shared library is compiled. You + may also have to change the compiler settings to ensure that + the Apache header files are correctly located. You can find + this library in your server root's modules directory. It is + best to grab an existing module .dsp file from the tree to + assure the build environment is configured correctly, or + alternately compare the compiler and link options to your + .dsp.
+ +This should create a DLL version of your module. Now simply
+ place it in the modules directory of your server
+ root, and use the
The LoadFile directive links in the named object files or + libraries when the server is started or restarted; this is used + to load additional code which may be required for some module + to work. Filename is either an absolute path or + relative to ServerRoot.
+The LoadModule directive links in the object file or library
+ filename and adds the module structure named
+ module to the list of active modules. Module
+ is the name of the external variable of type
+ module
in the file, and is listed as the Module Identifier
+ in the module documentation. Example:
loads the named module from the modules subdirectory of the + ServerRoot.
+Requests to documents sometimes cannot be served by the core + apache server because the request was misspelled or + miscapitalized. This module addresses this problem by trying to + find a matching document, even after all other modules gave up. + It does its work by comparing each document name in the + requested directory against the requested document name + without regard to case, and allowing + up to one misspelling (character insertion / + omission / transposition or wrong character). A list is built + with all document names which were matched using this + strategy.
+ +If, after scanning the directory,
+ +This directive enables or disables the spelling module. When + enabled, keep in mind that
+ +http://my.host/~apahce/
), just file names or
+ directory names.
+ ![]() +
+
+
+
+And third Per-Directory Directives (i.e. those with context ``server
+config, virtual host, directory, .htaccess''), which can pretty much occur
+everywhere. Especially both inside the server config files and the
+per-directory +Additional directives and environment variables provided by mod_ssl (via +on-the-fly mapping) for backward compatiblity to other Apache SSL solutions +are documented in the Compatibility chapter. + Configuration Directives+The most visible and error-prone things of mod_ssl are its configuration +directives. So we document them in great detail here to assist you in setting +up the best possible configuration of your SSL-aware webserver. + +SSLPassPhraseDialog++
+When Apache starts up it has to read the various Certificate (see SSLCertificateFile) and Private Key (see SSLCertificateKeyFile) files of the +SSL-enabled virtual servers. Because for security reasons the Private Key +files are usually encrypted, mod_ssl needs to query the administrator for a +Pass Phrase in order to decrypt those files. This query can be done in two ways +which can be configured by type: +
+Example: + ++ ++SSLPassPhraseDialog exec:/usr/local/apache/sbin/pp-filter ++ SSLMutex++
+This configures the SSL engine's semaphore (aka. lock) which is used for mutual +exclusion of operations which have to be done in a synchronized way between the +pre-forked Apache server processes. This directive can only be used in the +global server context because it's only useful to have one global mutex. + +The following Mutex types are available: +
+Example: + ++ ++SSLMutex file:/usr/local/apache/logs/ssl_mutex ++ SSLRandomSeed++
+This configures one or more sources for seeding the Pseudo Random Number
+Generator (PRNG) in OpenSSL at startup time (context is
+ +The following source variants are available: +
+Example: + ++ ++SSLRandomSeed startup builtin +SSLRandomSeed startup file:/dev/random +SSLRandomSeed startup file:/dev/urandom 1024 +SSLRandomSeed startup exec:/usr/local/bin/truerand 16 +SSLRandomSeed connect builtin +SSLRandomSeed connect file:/dev/random +SSLRandomSeed connect file:/dev/urandom 1024 ++ SSLSessionCache+
+This configures the storage type of the global/inter-process SSL Session +Cache. This cache is an optional facility which speeds up parallel request +processing. For requests to the same server process (via HTTP keep-alive), +OpenSSL already caches the SSL session information locally. But because modern +clients request inlined images and other data via parallel requests (usually +up to four parallel requests are common) those requests are served by +different pre-forked server processes. Here an inter-process cache +helps to avoid unneccessary session handshakes. + +The following two storage types are currently supported: +
+Examples: + ++ ++SSLSessionCache dbm:/usr/local/apache/logs/ssl_gcache_data +SSLSessionCache shm:/usr/local/apache/logs/ssl_gcache_data(512000) ++ SSLSessionCacheTimeout+
+This directive sets the timeout in seconds for the information stored in the +global/inter-process SSL Session Cache and the OpenSSL internal memory cache. +It can be set as low as 15 for testing, but should be set to higher +values like 300 in real life. + +Example: + ++ ++SSLSessionCacheTimeout 600 ++ SSLEngine+
+This directive toggles the usage of the SSL/TLS Protocol Engine. This is +usually used inside a <VirtualHost> section to enable SSL/TLS for a +particular virtual host. By default the SSL/TLS Protocol Engine is disabled +for both the main server and all configured virtual hosts. + +Example: + ++ ++<VirtualHost _default_:443> +SSLEngine on +... +</VirtualHost> ++ SSLProtocol+
+This directive can be used to control the SSL protocol flavors mod_ssl should +use when establishing its server environment. Clients then can only connect +with one of the provided protocols. + +The available (case-insensitive) protocols are: +
+Example: + ++ ++# enable SSLv3 and TLSv1, but not SSLv2 +SSLProtocol all -SSLv2 ++ SSLCipherSuite+
+This complex directive uses a colon-separated cipher-spec string +consisting of OpenSSL cipher specifications to configure the Cipher Suite the +client is permitted to negotiate in the SSL handshake phase. Notice that this +directive can be used both in per-server and per-directory context. In +per-server context it applies to the standard SSL handshake when a connection +is established. In per-directory context it forces a SSL renegotation with the +reconfigured Cipher Suite after the HTTP request was read but before the HTTP +response is sent. + +An SSL cipher specification in cipher-spec is composed of 4 major +attributes plus a few extra minor ones: +
+
+
+
+
+Now where this becomes interesting is that these can be put together
+to specify the order and ciphers you wish to use. To speed this up
+there are also aliases (
openssl ciphers
+-v '' command which provides a nice way to successively create the
+correct cipher-spec string. The default cipher-spec string
+is ``ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP '' which
+means the following: first, remove from consideration any ciphers that do not
+authenticate, i.e. for SSL only the Anonymous Diffie-Hellman ciphers. Next,
+use ciphers using RC4 and RSA. Next include the high, medium and then the low
+security ciphers. Finally pull all SSLv2 and export ciphers to the
+end of the list.
+++The complete list of particular RSA & DH ciphers for SSL is given in Table 2. ++$ openssl ciphers -v 'ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP' +NULL-SHA SSLv3 Kx=RSA Au=RSA Enc=None Mac=SHA1 +NULL-MD5 SSLv3 Kx=RSA Au=RSA Enc=None Mac=MD5 +EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1 +... ... ... ... ... +EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export +EXP-RC2-CBC-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC2(40) Mac=MD5 export +EXP-RC4-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export ++ +Example: + +++SSLCipherSuite RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW ++ +
+
+
+
+
SSLCertificateFile+
+This directive points to the PEM-encoded Certificate file for the server and +optionally also to the corresponding RSA or DSA Private Key file for it +(contained in the same file). If the contained Private Key is encrypted the +Pass Phrase dialog is forced at startup time. This directive can be used up to +two times (referencing different filenames) when both a RSA and a DSA based +server certificate is used in parallel. + +Example: + ++ ++SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt ++ SSLCertificateKeyFile+
+This directive points to the PEM-encoded Private Key file for the server. If
+the Private Key is not combined with the Certificate in the
+ +Example: + ++ ++SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key ++ SSLCertificateChainFile+
+This directive sets the optional all-in-one file where you can +assemble the certificates of Certification Authorities (CA) which form the +certificate chain of the server certificate. This starts with the issuing CA +certificate of of the server certificate and can range up to the root CA +certificate. Such a file is simply the concatenation of the various +PEM-encoded CA Certificate files, usually in certificate chain order. + +This should be used alternatively and/or additionally to SSLCACertificatePath for explicitly +constructing the server certificate chain which is sent to the browser in +addition to the server certificate. It is especially useful to avoid conflicts +with CA certificates when using client authentication. Because although +placing a CA certificate of the server certificate chain into SSLCACertificatePath has the same effect for +the certificate chain construction, it has the side-effect that client +certificates issued by this same CA certificate are also accepted on client +authentication. That's usually not one expect. + +But be careful: Providing the certificate chain works only if you are using a +single (either RSA or DSA) based server certificate. If you are +using a coupled RSA+DSA certificate pair, this will work only if actually both +certificates use the same certificate chain. Else the browsers will be +confused in this situation. + +Example: + ++ ++SSLCertificateChainFile /usr/local/apache/conf/ssl.crt/ca.crt ++ SSLCACertificatePath+
+This directive sets the directory where you keep the Certificates of +Certification Authorities (CAs) whose clients you deal with. These are used to +verify the client certificate on Client Authentication. +
+The files in this directory have to be PEM-encoded and are accessed through
+hash filenames. So usually you can't just place the Certificate files
+there: you also have to create symbolic links named
+hash-value.N. And you should always make sure this directory
+contains the appropriate symbolic links. Use the +Example: + ++ ++SSLCACertificatePath /usr/local/apache/conf/ssl.crt/ ++ SSLCACertificateFile+
+This directive sets the all-in-one file where you can assemble the +Certificates of Certification Authorities (CA) whose clients you deal +with. These are used for Client Authentication. Such a file is simply the +concatenation of the various PEM-encoded Certificate files, in order of +preference. This can be used alternatively and/or additionally to SSLCACertificatePath. + +Example: + ++ ++SSLCACertificateFile /usr/local/apache/conf/ssl.crt/ca-bundle-client.crt ++ SSLCARevocationPath+
+This directive sets the directory where you keep the Certificate Revocation +Lists (CRL) of Certification Authorities (CAs) whose clients you deal with. +These are used to revoke the client certificate on Client Authentication. +
+The files in this directory have to be PEM-encoded and are accessed through
+hash filenames. So usually you have not only to place the CRL files there.
+Additionally you have to create symbolic links named
+hash-value.rN. And you should always make sure this directory
+contains the appropriate symbolic links. Use the +Example: + ++ ++SSLCARevocationPath /usr/local/apache/conf/ssl.crl/ ++ SSLCARevocationFile+
+This directive sets the all-in-one file where you can assemble the +Certificate Revocation Lists (CRL) of Certification Authorities (CA) whose +clients you deal with. These are used for Client Authentication. +Such a file is simply the concatenation of the various PEM-encoded CRL +files, in order of preference. This can be used alternatively and/or +additionally to SSLCARevocationPath. + +Example: + ++ ++SSLCARevocationFile /usr/local/apache/conf/ssl.crl/ca-bundle-client.crl ++ SSLVerifyClient+
+This directive sets the Certificate verification level for the Client +Authentication. Notice that this directive can be used both in per-server and +per-directory context. In per-server context it applies to the client +authentication process used in the standard SSL handshake when a connection is +established. In per-directory context it forces a SSL renegotation with the +reconfigured client verification level after the HTTP request was read but +before the HTTP response is sent. + +The following levels are available for level: +
+Example: + ++ ++SSLVerifyClient require ++ SSLVerifyDepth+
+This directive sets how deeply mod_ssl should verify before deciding that the +clients don't have a valid certificate. Notice that this directive can be +used both in per-server and per-directory context. In per-server context it +applies to the client authentication process used in the standard SSL +handshake when a connection is established. In per-directory context it forces +a SSL renegotation with the reconfigured client verification depth after the +HTTP request was read but before the HTTP response is sent. +
+The depth actually is the maximum number of intermediate certificate issuers,
+i.e. the number of CA certificates which are max allowed to be followed while
+verifying the client certificate. A depth of 0 means that self-signed client
+certificates are accepted only, the default depth of 1 means the client
+certificate can be self-signed or has to be signed by a CA which is directly
+known to the server (i.e. the CA's certificate is under
+ +Example: + ++ ++SSLVerifyDepth 10 ++ SSLLog+
+This directive sets the name of the dedicated SSL protocol engine logfile.
+Error type messages are additionally duplicated to the general Apache error
+log file (directive +Example: + ++ ++SSLLog /usr/local/apache/logs/ssl_engine_log ++ SSLLogLevel+
+This directive sets the verbosity degree of the dedicated SSL protocol engine +logfile. The level is one of the following (in ascending order where +higher levels include lower levels): +
+Example: + ++ ++SSLLogLevel warn ++ SSLOptions+
+This directive can be used to control various run-time options on a
+per-directory basis. Normally, if multiple +The available options are: +
+Example: + ++ ++SSLOptions +FakeBasicAuth -StrictRequire +<Files ~ "\.(cgi|shtml)$"> + SSLOptions +StdEnvVars +CompatEnvVars -ExportCertData +<Files> ++ SSLRequireSSL+
+This directive forbids access unless HTTP over SSL (i.e. HTTPS) is enabled for +the current connection. This is very handy inside the SSL-enabled virtual +host or directories for defending against configuration errors that expose +stuff that should be protected. When this directive is present all requests +are denied which are not using SSL. + +Example: + ++ ++SSLRequireSSL ++ SSLRequire+
+This directive specifies a general access requirement which has to be +fulfilled in order to allow access. It's a very powerful directive because the +requirement specification is an arbitrarily complex boolean expression +containing any number of access checks. + +The expression must match the following syntax (given as a BNF +grammar notation): + ++while for+expr ::= "true" | "false" + | "!" expr + | expr "&&" expr + | expr "||" expr + | "(" expr ")" + | comp + +comp ::= word "==" word | word "eq" word + | word "!=" word | word "ne" word + | word "<" word | word "lt" word + | word "<=" word | word "le" word + | word ">" word | word "gt" word + | word ">=" word | word "ge" word + | word "in" "{" wordlist "}" + | word "=~" regex + | word "!~" regex + +wordlist ::= word + | wordlist "," word + +word ::= digit + | cstring + | variable + | function + +digit ::= [0-9]+ +cstring ::= "..." +variable ::= "%{" varname "}" +function ::= funcname "(" funcargs ")" ++ varname any variable from Table 3
+can be used. Finally for funcname the following functions
+are available:
+
+Example: + +++SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \ + and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \ + and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \ + and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \ + and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \ + or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/ ++
+
+
+
+ + + Additional Features+Environment Variables+This module provides a lot of SSL information as additional environment +variables to the SSI and CGI namespace. The generated variables are listed in +Table 4. For backward compatibility the information can +be made available under different names, too. Look in the Compatibility chapter for details on the +compatibility variables. ++
+
+
+
+ Custom Log Formats+When mod_ssl is built into Apache or at least loaded (under DSO situation) +additional functions exist for the Custom Log Format of mod_log_config. First there is an additional +``%{ varname}x '' eXtension format function
+which can be used to expand any variables provided by any module, especially
+those provided by mod_ssl which can you find in Table 4.
+
+For backward compatibility there is additionally a special
+`` +Example: + +++CustomLog logs/ssl_request_log \ + "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" ++
+
|
+
This module provides SSL v2/v3 and TLS v1 support for the Apache +HTTP Server. It was contributed by Ralf S. Engeschall based on his +mod_ssl project and originally derived from work by Ben Laurie.
+ +This module relies on OpenSSL +to provide the cryptography engine.
+ +Further details, discussion, and examples are provided in the +SSL documentation.
+This module provides a lot of SSL information as additional environment +variables to the SSI and CGI namespace. The generated variables are listed in +the table below. For backward compatibility the information can +be made available under different names, too. Look in the Compatibility chapter for details on the +compatibility variables.
+ +
+
|
When %{
varname}x
''
+eXtension format function which can be used to expand any variables
+provided by any module, especially those provided by mod_ssl which can
+you find in the above table.
+For backward compatibility there is additionally a special
+``%{
name}c
'' cryptography format function
+provided. Information about this function is provided in the Compatibility chapter.
+Example:
+
+When Apache starts up it has to read the various Certificate (see
+
builtin
+ + This is the default where an interactive terminal dialog occurs at startup + time just before Apache detaches from the terminal. Here the administrator + has to manually enter the Pass Phrase for each encrypted Private Key file. + Because a lot of SSL-enabled virtual hosts can be configured, the + following reuse-scheme is used to minimize the dialog: When a Private Key + file is encrypted, all known Pass Phrases (at the beginning there are + none, of course) are tried. If one of those known Pass Phrases succeeds no + dialog pops up for this particular Private Key file. If none succeeded, + another Pass Phrase is queried on the terminal and remembered for the next + round (where it perhaps can be reused).
++ This scheme allows mod_ssl to be maximally flexible (because for N encrypted + Private Key files you can use N different Pass Phrases - but then + you have to enter all of them, of course) while minimizing the terminal + dialog (i.e. when you use a single Pass Phrase for all N Private Key files + this Pass Phrase is queried only once).
exec:/path/to/program
+
+ Here an external program is configured which is called at startup for each
+ encrypted Private Key file. It is called with two arguments (the first is
+ of the form ``servername:portnumber
'', the second is either
+ ``RSA
'' or ``DSA
''), which indicate for which
+ server and algorithm it has to print the corresponding Pass Phrase to
+ stdout
. The intent is that this external program first runs
+ security checks to make sure that the system is not compromised by an
+ attacker, and only when these checks were passed successfully it provides
+ the Pass Phrase.
+ Both these security checks, and the way the Pass Phrase is determined, can
+ be as complex as you like. Mod_ssl just defines the interface: an
+ executable program which provides the Pass Phrase on stdout
.
+ Nothing more or less! So, if you're really paranoid about security, here
+ is your interface. Anything else has to be left as an exercise to the
+ administrator, because local security requirements are so different.
+ The reuse-algorithm above is used here, too. In other words: The external + program is called only once per unique Pass Phrase.
+Example:
++This configures the SSL engine's semaphore (aka. lock) which is used for mutual +exclusion of operations which have to be done in a synchronized way between the +pre-forked Apache server processes. This directive can only be used in the +global server context because it's only useful to have one global mutex.
++The following Mutex types are available:
+none
+ + This is the default where no Mutex is used at all. Use it at your own + risk. But because currently the Mutex is mainly used for synchronizing + write access to the SSL Session Cache you can live without it as long + as you accept a sometimes garbled Session Cache. So it's not recommended + to leave this the default. Instead configure a real Mutex.
file:/path/to/mutex
+
+ This is the portable and (under Unix) always provided Mutex variant where
+ a physical (lock-)file is used as the Mutex. Always use a local disk
+ filesystem for /path/to/mutex
and never a file residing on a
+ NFS- or AFS-filesystem. Note: Internally, the Process ID (PID) of the
+ Apache parent process is automatically appended to
+ /path/to/mutex
to make it unique, so you don't have to worry
+ about conflicts yourself. Notice that this type of mutex is not available
+ under the Win32 environment. There you have to use the semaphore
+ mutex.
sem
+ + This is the most elegant but also most non-portable Mutex variant where a + SysV IPC Semaphore (under Unix) and a Windows Mutex (under Win32) is used + when possible. It is only available when the underlying platform + supports it.
+This configures one or more sources for seeding the Pseudo Random Number
+Generator (PRNG) in OpenSSL at startup time (context is
+startup
) and/or just before a new SSL connection is established
+(context is connect
). This directive can only be used
+in the global server context because the PRNG is a global facility.
+The following source variants are available:
+builtin
+ This is the always available builtin seeding source. It's usage + consumes minimum CPU cycles under runtime and hence can be always used + without drawbacks. The source used for seeding the PRNG contains of the + current time, the current process id and (when applicable) a randomly + choosen 1KB extract of the inter-process scoreboard structure of Apache. + The drawback is that this is not really a strong source and at startup + time (where the scoreboard is still not available) this source just + produces a few bytes of entropy. So you should always, at least for the + startup, use an additional seeding source.
file:/path/to/source
+
+ This variant uses an external file /path/to/source
as the
+ source for seeding the PRNG. When bytes is specified, only the
+ first bytes number of bytes of the file form the entropy (and
+ bytes is given to /path/to/source
as the first
+ argument). When bytes is not specified the whole file forms the
+ entropy (and 0
is given to /path/to/source
as
+ the first argument). Use this especially at startup time, for instance
+ with an available /dev/random
and/or
+ /dev/urandom
devices (which usually exist on modern Unix
+ derivates like FreeBSD and Linux).
+ But be careful: Usually /dev/random
provides only as
+ much entropy data as it actually has, i.e. when you request 512 bytes of
+ entropy, but the device currently has only 100 bytes available two things
+ can happen: On some platforms you receive only the 100 bytes while on
+ other platforms the read blocks until enough bytes are available (which
+ can take a long time). Here using an existing /dev/urandom
is
+ better, because it never blocks and actually gives the amount of requested
+ data. The drawback is just that the quality of the received data may not
+ be the best.
+ On some platforms like FreeBSD one can even control how the entropy is
+ actually generated, i.e. by which system interrupts. More details one can
+ find under rndcontrol(8) on those platforms. Alternatively, when
+ your system lacks such a random device, you can use tool
+ like EGD
+ (Entropy Gathering Daemon) and run it's client program with the
+ exec:/path/to/program/
variant (see below) or use
+ egd:/path/to/egd-socket
(see below).
exec:/path/to/program
+
+ This variant uses an external executable
+ /path/to/program
as the source for seeding the
+ PRNG. When bytes is specified, only the first
+ bytes number of bytes of its stdout
contents
+ form the entropy. When bytes is not specified, the
+ entirety of the data produced on stdout
form the
+ entropy. Use this only at startup time when you need a very strong
+ seeding with the help of an external program (for instance as in
+ the example above with the truerand
utility you can
+ find in the mod_ssl distribution which is based on the AT&T
+ truerand library). Using this in the connection context
+ slows down the server too dramatically, of course. So usually you
+ should avoid using external programs in that context.
egd:/path/to/egd-socket
(Unix only)
+ + This variant uses the Unix domain socket of the + external Entropy Gathering Daemon (EGD) (see http://www.lothar.com/tech + /crypto/) to seed the PRNG. Use this if no random device exists + on your platform.
+This configures the storage type of the global/inter-process SSL Session +Cache. This cache is an optional facility which speeds up parallel request +processing. For requests to the same server process (via HTTP keep-alive), +OpenSSL already caches the SSL session information locally. But because modern +clients request inlined images and other data via parallel requests (usually +up to four parallel requests are common) those requests are served by +different pre-forked server processes. Here an inter-process cache +helps to avoid unneccessary session handshakes.
++The following two storage types are currently supported:
+none
+ + This is the default and just disables the global/inter-process Session + Cache. There is no drawback in functionality, but a noticeable speed + penalty can be observed.
dbm:/path/to/datafile
+ + This makes use of a DBM hashfile on the local disk to synchronize the + local OpenSSL memory caches of the server processes. The slight increase + in I/O on the server results in a visible request speedup for your + clients, so this type of storage is generally recommended.
shm:/path/to/datafile
[(
size)
]
+
+ This makes use of a high-performance hash table (approx. size bytes
+ in size) inside a shared memory segment in RAM (established via
+ /path/to/datafile
) to synchronize the local OpenSSL memory
+ caches of the server processes. This storage type is not available on all
+ platforms. See the mod_ssl INSTALL
document for details on
+ how to build Apache+EAPI with shared memory support.
+This directive sets the timeout in seconds for the information stored in the +global/inter-process SSL Session Cache and the OpenSSL internal memory cache. +It can be set as low as 15 for testing, but should be set to higher +values like 300 in real life.
+
+This directive toggles the usage of the SSL/TLS Protocol Engine. This
+is usually used inside a
+This directive can be used to control the SSL protocol flavors mod_ssl should +use when establishing its server environment. Clients then can only connect +with one of the provided protocols.
++The available (case-insensitive) protocols are:
+SSLv2
+ + This is the Secure Sockets Layer (SSL) protocol, version 2.0. It is the + original SSL protocol as designed by Netscape Corporation.
SSLv3
+ + This is the Secure Sockets Layer (SSL) protocol, version 3.0. It is the + successor to SSLv2 and the currently (as of February 1999) de-facto + standardized SSL protocol from Netscape Corporation. It's supported by + almost all popular browsers.
TLSv1
+ + This is the Transport Layer Security (TLS) protocol, version 1.0. It is the + successor to SSLv3 and currently (as of February 1999) still under + construction by the Internet Engineering Task Force (IETF). It's still + not supported by any popular browsers.
All
+
+ This is a shortcut for ``+SSLv2 +SSLv3 +TLSv1
'' and a
+ convinient way for enabling all protocols except one when used in
+ combination with the minus sign on a protocol as the example above
+ shows.
+This complex directive uses a colon-separated cipher-spec string +consisting of OpenSSL cipher specifications to configure the Cipher Suite the +client is permitted to negotiate in the SSL handshake phase. Notice that this +directive can be used both in per-server and per-directory context. In +per-server context it applies to the standard SSL handshake when a connection +is established. In per-directory context it forces a SSL renegotation with the +reconfigured Cipher Suite after the HTTP request was read but before the HTTP +response is sent.
++An SSL cipher specification in cipher-spec is composed of 4 major +attributes plus a few extra minor ones:
+An SSL cipher can also be an export cipher and is either a SSLv2 or SSLv3/TLSv1 +cipher (here TLSv1 is equivalent to SSLv3). To specify which ciphers to use, +one can either specify all the Ciphers, one at a time, or use aliases to +specify the preference and order for the ciphers (see Table +1).
+ +
+
|
+Now where this becomes interesting is that these can be put together
+to specify the order and ciphers you wish to use. To speed this up
+there are also aliases (SSLv2, SSLv3, TLSv1, EXP, LOW, MEDIUM,
+HIGH
) for certain groups of ciphers. These tags can be joined
+together with prefixes to form the cipher-spec. Available
+prefixes are:
+
: add ciphers to list and pull them to current location in list-
: remove cipher from list (can be added later again)!
: kill cipher from list completely (can not be added later again)A simpler way to look at all of this is to use the ``openssl ciphers
+-v
'' command which provides a nice way to successively create the
+correct cipher-spec string. The default cipher-spec string
+is ``ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
'' which
+means the following: first, remove from consideration any ciphers that do not
+authenticate, i.e. for SSL only the Anonymous Diffie-Hellman ciphers. Next,
+use ciphers using RC4 and RSA. Next include the high, medium and then the low
+security ciphers. Finally pull all SSLv2 and export ciphers to the
+end of the list.
+$ openssl ciphers -v 'ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP' +NULL-SHA SSLv3 Kx=RSA Au=RSA Enc=None Mac=SHA1 +NULL-MD5 SSLv3 Kx=RSA Au=RSA Enc=None Mac=MD5 +EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1 +... ... ... ... ... +EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export +EXP-RC2-CBC-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC2(40) Mac=MD5 export +EXP-RC4-MD5 SSLv2 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export ++
The complete list of particular RSA & DH ciphers for SSL is given in Table 2.
+
+
|
+This directive points to the PEM-encoded Certificate file for the server and +optionally also to the corresponding RSA or DSA Private Key file for it +(contained in the same file). If the contained Private Key is encrypted the +Pass Phrase dialog is forced at startup time. This directive can be used up to +two times (referencing different filenames) when both a RSA and a DSA based +server certificate is used in parallel.
+
+This directive points to the PEM-encoded Private Key file for the
+server. If the Private Key is not combined with the Certificate in the
+
+This directive sets the optional all-in-one file where you can +assemble the certificates of Certification Authorities (CA) which form the +certificate chain of the server certificate. This starts with the issuing CA +certificate of of the server certificate and can range up to the root CA +certificate. Such a file is simply the concatenation of the various +PEM-encoded CA Certificate files, usually in certificate chain order.
+
+This should be used alternatively and/or additionally to
+But be careful: Providing the certificate chain works only if you are using a +single (either RSA or DSA) based server certificate. If you are +using a coupled RSA+DSA certificate pair, this will work only if actually both +certificates use the same certificate chain. Else the browsers will be +confused in this situation.
++This directive sets the directory where you keep the Certificates of +Certification Authorities (CAs) whose clients you deal with. These are used to +verify the client certificate on Client Authentication.
+
+The files in this directory have to be PEM-encoded and are accessed through
+hash filenames. So usually you can't just place the Certificate files
+there: you also have to create symbolic links named
+hash-value.N
. And you should always make sure this directory
+contains the appropriate symbolic links. Use the Makefile
which
+comes with mod_ssl to accomplish this task.
+This directive sets the all-in-one file where you can assemble the
+Certificates of Certification Authorities (CA) whose clients you deal
+with. These are used for Client Authentication. Such a file is simply the
+concatenation of the various PEM-encoded Certificate files, in order of
+preference. This can be used alternatively and/or additionally to
+
+This directive sets the directory where you keep the Certificate Revocation +Lists (CRL) of Certification Authorities (CAs) whose clients you deal with. +These are used to revoke the client certificate on Client Authentication.
+
+The files in this directory have to be PEM-encoded and are accessed through
+hash filenames. So usually you have not only to place the CRL files there.
+Additionally you have to create symbolic links named
+hash-value.rN
. And you should always make sure this directory
+contains the appropriate symbolic links. Use the Makefile
which
+comes with
+This directive sets the all-in-one file where you can
+assemble the Certificate Revocation Lists (CRL) of Certification
+Authorities (CA) whose clients you deal with. These are used
+for Client Authentication. Such a file is simply the concatenation of
+the various PEM-encoded CRL files, in order of preference. This can be
+used alternatively and/or additionally to
+This directive sets the Certificate verification level for the Client +Authentication. Notice that this directive can be used both in per-server and +per-directory context. In per-server context it applies to the client +authentication process used in the standard SSL handshake when a connection is +established. In per-directory context it forces a SSL renegotation with the +reconfigured client verification level after the HTTP request was read but +before the HTTP response is sent.
++The following levels are available for level:
+In practice only levels none and +require are really interesting, because level +optional doesn't work with all browsers and level +optional_no_ca is actually against the idea of +authentication (but can be used to establish SSL test pages, etc.)
++This directive sets how deeply mod_ssl should verify before deciding that the +clients don't have a valid certificate. Notice that this directive can be +used both in per-server and per-directory context. In per-server context it +applies to the client authentication process used in the standard SSL +handshake when a connection is established. In per-directory context it forces +a SSL renegotation with the reconfigured client verification depth after the +HTTP request was read but before the HTTP response is sent.
+
+The depth actually is the maximum number of intermediate certificate issuers,
+i.e. the number of CA certificates which are max allowed to be followed while
+verifying the client certificate. A depth of 0 means that self-signed client
+certificates are accepted only, the default depth of 1 means the client
+certificate can be self-signed or has to be signed by a CA which is directly
+known to the server (i.e. the CA's certificate is under
+
+This directive sets the name of the dedicated SSL protocol engine logfile.
+Error type messages are additionally duplicated to the general Apache error
+log file (directive ErrorLog
). Put this somewhere where it cannot
+be used for symlink attacks on a real server (i.e. somewhere where only root
+can write). If the file-path does not begin with a slash
+('/
') then it is assumed to be relative to the Server
+Root. If file-path begins with a bar ('|
') then the
+following string is assumed to be a path to an executable program to which a
+reliable pipe can be established. The directive should occur only once per
+virtual server config.
+This directive sets the verbosity degree of the dedicated SSL protocol engine +logfile. The level is one of the following (in ascending order where +higher levels include lower levels):
+none
error
'' are still written to the general Apache error
+ logfile.
+error
warn
info
trace
debug
+This directive can be used to control various run-time options on a
+per-directory basis. Normally, if multiple SSLOptions
+could apply to a directory, then the most specific one is taken
+completely; the options are not merged. However if all the
+options on the SSLOptions
directive are preceded by a
+plus (+
) or minus (-
) symbol, the options
+are merged. Any options preceded by a +
are added to the
+options currently in force, and any options preceded by a
+-
are removed from the options currently in force.
+The available options are:
+StdEnvVars
+ + When this option is enabled, the standard set of SSL related CGI/SSI + environment variables are created. This per default is disabled for + performance reasons, because the information extraction step is a + rather expensive operation. So one usually enables this option for + CGI and SSI requests only.
+CompatEnvVars
+ + When this option is enabled, additional CGI/SSI environment variables are + created for backward compatibility to other Apache SSL solutions. Look in + the Compatibility chapter for details + on the particular variables generated.
+ExportCertData
+
+ When this option is enabled, additional CGI/SSI environment variables are
+ created: SSL_SERVER_CERT
, SSL_CLIENT_CERT
and
+ SSL_CLIENT_CERT_CHAIN
n (with n = 0,1,2,..).
+ These contain the PEM-encoded X.509 Certificates of server and client for
+ the current HTTPS connection and can be used by CGI scripts for deeper
+ Certificate checking. Additionally all other certificates of the client
+ certificate chain are provided, too. This bloats up the environment a
+ little bit which is why you have to use this option to enable it on
+ demand.
FakeBasicAuth
+
+ When this option is enabled, the Subject Distinguished Name (DN) of the
+ Client X509 Certificate is translated into a HTTP Basic Authorization
+ username. This means that the standard Apache authentication methods can
+ be used for access control. The user name is just the Subject of the
+ Client's X509 Certificate (can be determined by running OpenSSL's
+ openssl x509
command: openssl x509 -noout -subject -in
+
certificate.crt
). Note that no password is
+ obtained from the user. Every entry in the user file needs this password:
+ ``xxj31ZMTZzkVA
'', which is the DES-encrypted version of the
+ word `password
''. Those who live under MD5-based encryption
+ (for instance under FreeBSD or BSD/OS, etc.) should use the following MD5
+ hash of the same word: ``$1$OXLyS...$Owx8s2/m9/gfkcRVXzgoE/
''.
StrictRequire
+
+ This forces forbidden access when SSLRequireSSL
or
+ SSLRequire
successfully decided that access should be
+ forbidden. Usually the default is that in the case where a ``Satisfy
+ any
'' directive is used, and other access restrictions are passed,
+ denial of access due to SSLRequireSSL
or
+ SSLRequire
is overridden (because that's how the Apache
+ Satisfy
mechanism should work.) But for strict access restriction
+ you can use SSLRequireSSL
and/or SSLRequire
in
+ combination with an ``SSLOptions +StrictRequire
''. Then an
+ additional ``Satisfy Any
'' has no chance once mod_ssl has
+ decided to deny access.
OptRenegotiate
+ + This enables optimized SSL connection renegotiation handling when SSL + directives are used in per-directory context. By default a strict + scheme is enabled where every per-directory reconfiguration of + SSL parameters causes a full SSL renegotiation handshake. When this + option is used mod_ssl tries to avoid unnecessary handshakes by doing more + granular (but still safe) parameter checks. Nevertheless these granular + checks sometimes maybe not what the user expects, so enable this on a + per-directory basis only, please.
++This directive forbids access unless HTTP over SSL (i.e. HTTPS) is enabled for +the current connection. This is very handy inside the SSL-enabled virtual +host or directories for defending against configuration errors that expose +stuff that should be protected. When this directive is present all requests +are denied which are not using SSL.
++This directive specifies a general access requirement which has to be +fulfilled in order to allow access. It's a very powerful directive because the +requirement specification is an arbitrarily complex boolean expression +containing any number of access checks.
++The expression must match the following syntax (given as a BNF +grammar notation):
++++expr ::= "true" | "false" + | "!" expr + | expr "&&" expr + | expr "||" expr + | "(" expr ")" + | comp + +comp ::= word "==" word | word "eq" word + | word "!=" word | word "ne" word + | word "<" word | word "lt" word + | word "<=" word | word "le" word + | word ">" word | word "gt" word + | word ">=" word | word "ge" word + | word "in" "{" wordlist "}" + | word "=~" regex + | word "!~" regex + +wordlist ::= word + | wordlist "," word + +word ::= digit + | cstring + | variable + | function + +digit ::= [0-9]+ +cstring ::= "..." +variable ::= "%{" varname "}" +function ::= funcname "(" funcargs ")" ++
while for varname
any variable from Table 3 can be used. Finally for
+funcname
the following functions are available:
file(
filename)
+ + This function takes one string argument and expands to the contents of the + file. This is especially useful for matching this contents against a + regular expression, etc.
+Notice that expression is first parsed into an internal machine +representation and then evaluated in a second step. Actually, in Global and +Per-Server Class context expression is parsed at startup time and +at runtime only the machine representation is executed. For Per-Directory +context this is different: here expression has to be parsed and +immediately executed for every request.
+
+
|
The Status module allows a server administrator to find out + how well their server is performing. A HTML page is presented + that gives the current server statistics in an easily readable + form. If required this page can be made to automatically + refresh (given a compatible browser). Another page gives a + simple machine-readable list of the current server state.
+ +The details given are:
+ +httpd.conf
+ configuration file
+You can now access server statistics by using a Web browser
+ to access the page
+ http://your.server.name/server-status
Note that
http://your.server.name/server-status?refresh=N
to
+ refresh the page every N seconds.
+
+http://your.server.name/server-status?auto
. This
+ is useful when automatically run, see the Perl program in the
+ /support
directory of Apache,
+ log_server_status
.
+
+ .htaccess
). This may have security-related
+ ramifications for your site.
+ This setting applies to the entire server, and cannot be + enabled or disabled on a virtualhost-by-virtualhost basis.
+This module allows CGI scripts to run as a specified user + and Group.
+The SuexecUserGroup
directive allows you to
+ specify a user and group for CGI programs to run as. Non-CGI
+ requests are still processes with the user specified in the
+ User directive. This directive replaces using the User and
+ Group directives inside of VirtualHosts.
This module provides a magic token for each request which is
+ guaranteed to be unique across "all" requests under very
+ specific conditions. The unique identifier is even unique
+ across multiple machines in a properly configured cluster of
+ machines. The environment variable UNIQUE_ID
is
+ set to the identifier for each request. Unique identifiers are
+ useful for various reasons which are beyond the scope of this
+ document.
First a brief recap of how the Apache server works on Unix + machines. This feature currently isn't supported on Windows NT. + On Unix machines, Apache creates several children, the children + process requests one at a time. Each child can serve multiple + requests in its lifetime. For the purpose of this discussion, + the children don't share any data with each other. We'll refer + to the children as httpd processes.
+ +Your website has one or more machines under your + administrative control, together we'll call them a cluster of + machines. Each machine can possibly run multiple instances of + Apache. All of these collectively are considered "the + universe", and with certain assumptions we'll show that in this + universe we can generate unique identifiers for each request, + without extensive communication between machines in the + cluster.
+ +The machines in your cluster should satisfy these + requirements. (Even if you have only one machine you should + synchronize its clock with NTP.)
+ +As far as operating system assumptions go, we assume that + pids (process ids) fit in 32-bits. If the operating system uses + more than 32-bits for a pid, the fix is trivial but must be + performed in the code.
+ +Given those assumptions, at a single point in time we can + identify any httpd process on any machine in the cluster from + all other httpd processes. The machine's IP address and the pid + of the httpd process are sufficient to do this. So in order to + generate unique identifiers for requests we need only + distinguish between different points in time.
+ +To distinguish time we will use a Unix timestamp (seconds + since January 1, 1970 UTC), and a 16-bit counter. The timestamp + has only one second granularity, so the counter is used to + represent up to 65536 values during a single second. The + quadruple ( ip_addr, pid, time_stamp, counter ) is + sufficient to enumerate 65536 requests per second per httpd + process. There are issues however with pid reuse over time, and + the counter is used to alleviate this issue.
+ +When an httpd child is created, the counter is initialized + with ( current microseconds divided by 10 ) modulo 65536 (this + formula was chosen to eliminate some variance problems with the + low order bits of the microsecond timers on some systems). When + a unique identifier is generated, the time stamp used is the + time the request arrived at the web server. The counter is + incremented every time an identifier is generated (and allowed + to roll over).
+ +The kernel generates a pid for each process as it forks the + process, and pids are allowed to roll over (they're 16-bits on + many Unixes, but newer systems have expanded to 32-bits). So + over time the same pid will be reused. However unless it is + reused within the same second, it does not destroy the + uniqueness of our quadruple. That is, we assume the system does + not spawn 65536 processes in a one second interval (it may even + be 32768 processes on some Unixes, but even this isn't likely + to happen).
+ +Suppose that time repeats itself for some reason. That is, + suppose that the system's clock is screwed up and it revisits a + past time (or it is too far forward, is reset correctly, and + then revisits the future time). In this case we can easily show + that we can get pid and time stamp reuse. The choice of + initializer for the counter is intended to help defeat this. + Note that we really want a random number to initialize the + counter, but there aren't any readily available numbers on most + systems (i.e., you can't use rand() because you need + to seed the generator, and can't seed it with the time because + time, at least at one second resolution, has repeated itself). + This is not a perfect defense.
+ +How good a defense is it? Suppose that one of your machines + serves at most 500 requests per second (which is a very + reasonable upper bound at this writing, because systems + generally do more than just shovel out static files). To do + that it will require a number of children which depends on how + many concurrent clients you have. But we'll be pessimistic and + suppose that a single child is able to serve 500 requests per + second. There are 1000 possible starting counter values such + that two sequences of 500 requests overlap. So there is a 1.5% + chance that if time (at one second resolution) repeats itself + this child will repeat a counter value, and uniqueness will be + broken. This was a very pessimistic example, and with real + world values it's even less likely to occur. If your system is + such that it's still likely to occur, then perhaps you should + make the counter 32 bits (by editing the code).
+ +You may be concerned about the clock being "set back" during + summer daylight savings. However this isn't an issue because + the times used here are UTC, which "always" go forward. Note + that x86 based Unixes may need proper configuration for this to + be true -- they should be configured to assume that the + motherboard clock is on UTC and compensate appropriately. But + even still, if you're running NTP then your UTC time will be + correct very shortly after reboot.
+ +The UNIQUE_ID
environment variable is
+ constructed by encoding the 112-bit (32-bit IP address, 32 bit
+ pid, 32 bit time stamp, 16 bit counter) quadruple using the
+ alphabet [A-Za-z0-9@-]
in a manner similar to MIME
+ base64 encoding, producing 19 characters. The MIME base64
+ alphabet is actually [A-Za-z0-9+/]
however
+ +
and /
need to be specially encoded
+ in URLs, which makes them less desirable. All values are
+ encoded in network byte ordering so that the encoding is
+ comparable across architectures of different byte ordering. The
+ actual ordering of the encoding is: time stamp, IP address,
+ pid, counter. This ordering has a purpose, but it should be
+ emphasized that applications should not dissect the encoding.
+ Applications should treat the entire encoded
+ UNIQUE_ID
as an opaque token, which can be
+ compared against other UNIQUE_ID
s for equality
+ only.
The ordering was chosen such that it's possible to change
+ the encoding in the future without worrying about collision
+ with an existing database of UNIQUE_ID
s. The new
+ encodings should also keep the time stamp as the first element,
+ and can otherwise use the same alphabet and bit length. Since
+ the time stamps are essentially an increasing sequence, it's
+ sufficient to have a flag second in which all machines
+ in the cluster stop serving and request, and stop using the old
+ encoding format. Afterwards they can resume requests and begin
+ issuing the new encodings.
This we believe is a relatively portable solution to this + problem. It can be extended to multithreaded systems like + Windows NT, and can grow with future needs. The identifiers + generated have essentially an infinite life-time because future + identifiers can be made longer as required. Essentially no + communication is required between machines in the cluster (only + NTP synchronization is required, which is low overhead), and no + communication between httpd processes is required (the + communication is implicit in the pid value assigned by the + kernel). In very specific situations the identifier can be + shortened, but more information needs to be assumed (for + example the 32-bit IP address is overkill for any site, but + there is no portable shorter replacement for it).
+UserDir public_html
+form are only available in Apache 1.1 or above. Use of the
+enabled
keyword, or disabled
with a
+list of usernames, is only available in Apache 1.3 and
+above.The UserDir directive sets the real directory in a user's + home directory to use when a request for a document for a user + is received. Directory-filename is one of the + following:
+ +disabled
. This turns off
+ all username-to-directory translations except those
+ explicitly named with the enabled
keyword (see
+ below).disabled
followed by a
+ space-delimited list of usernames. Usernames that appear in
+ such a list will never have directory translation
+ performed, even if they appear in an enabled
+ clause.enabled
followed by a
+ space-delimited list of usernames. These usernames will have
+ directory translation performed even if a global disable is
+ in effect, but not if they also appear in a
+ disabled
clause.If neither the enabled
nor the
+ disabled
keywords appear in the
+ Userdir
directive, the argument is treated as a
+ filename pattern, and is used to turn the name into a directory
+ specification. A request for
+ http://www.foo.com/~bob/one/two.html
will be
+ translated to:
UserDir directive used | +Translated path |
---|---|
UserDir public_html | ~bob/public_html/one/two.html |
UserDir /usr/web | /usr/web/bob/one/two.html |
UserDir /home/*/www | /home/bob/www/one/two.html |
The following directives will send redirects to the client:
+ +UserDir directive used | +Translated path |
---|---|
UserDir http://www.foo.com/users | http://www.foo.com/users/bob/one/two.html |
UserDir +http://www.foo.com/*/usr | http://www.foo.com/bob/usr/one/two.html |
UserDir +http://www.foo.com/~*/ | http://www.foo.com/~bob/one/two.html |
+ Be careful when using this directive; for instance, ++ +"UserDir ./"
would map +"/~root"
to"/"
- which is probably + undesirable. If you are running Apache 1.3 or above, it is + strongly recommended that your configuration include a + "UserDir disabled root
" declaration. + See also theDirectory + directive and the Security + Tips page for more information. +
Previous releases of Apache have included a module which + generates a 'clickstream' log of user activity on a site using + cookies. This was called the "cookies" module, mod_cookies. In + Apache 1.2 and later this module has been renamed the "user + tracking" module, mod_usertrack. This module has been + simplified and new directives added.
+Previously, the cookies module (now the user tracking + module) did its own logging, using the CookieLog + directive. In this release, this module does no logging at all. + Instead, a configurable log format file should be used to log + user click-streams. This is possible because the logging module + now allows multiple log files. The cookie itself is logged by + using the text %{cookie}n in the log file format. For + example:
+For backward compatibility the configurable log module + implements the old CookieLog directive, but this + should be upgraded to the above CustomLog directive.
+(the following is from message + <022701bda43d$9d32bbb0$1201a8c0@christian.office.sane.com> + in the new-httpd archives) +
+From: "Christian Allen" <christian@sane.com> +Subject: Re: Apache Y2K bug in mod_usertrack.c +Date: Tue, 30 Jun 1998 11:41:56 -0400 + +Did some work with cookies and dug up some info that might be useful. + +True, Netscape claims that the correct format NOW is four digit dates, and +four digit dates do in fact work... for Netscape 4.x (Communicator), that +is. However, 3.x and below do NOT accept them. It seems that Netscape +originally had a 2-digit standard, and then with all of the Y2K hype and +probably a few complaints, changed to a four digit date for Communicator. +Fortunately, 4.x also understands the 2-digit format, and so the best way to +ensure that your expiration date is legible to the client's browser is to +use 2-digit dates. + +However, this does not limit expiration dates to the year 2000; if you use +an expiration year of "13", for example, it is interpreted as 2013, NOT +1913! In fact, you can use an expiration year of up to "37", and it will be +understood as "2037" by both MSIE and Netscape versions 3.x and up (not sure +about versions previous to those). Not sure why Netscape used that +particular year as its cut-off point, but my guess is that it was in respect +to UNIX's 2038 problem. Netscape/MSIE 4.x seem to be able to understand +2-digit years beyond that, at least until "50" for sure (I think they +understand up until about "70", but not for sure). + +Summary: Mozilla 3.x and up understands two digit dates up until "37" +(2037). Mozilla 4.x understands up until at least "50" (2050) in 2-digit +form, but also understands 4-digit years, which can probably reach up until +9999. Your best bet for sending a long-life cookie is to send it for some +time late in the year "37". ++ +
This directive controls the setting of the domain to which + the tracking cookie applies. If not present, no domain is + included in the cookie header field.
+ +The domain string must begin with a dot, and + must include at least one embedded dot. That is, + ".foo.com" is legal, but "foo.bar.com" and ".com" are not.
+When used, this directive sets an expiry time on the cookie + generated by the usertrack module. The expiry-period + can be given either as a number of seconds, or in the format + such as "2 weeks 3 days 7 hours". Valid denominations are: + years, months, weeks, hours, minutes and seconds. If the expiry + time is in any format other than one number indicating the + number of seconds, it must be enclosed by double quotes.
+ +If this directive is not used, cookies last only for the + current browser session.
+This directive allows you to change the name of the cookie
+ this module uses for its tracking purposes. By default the
+ cookie is named "Apache
".
You must specify a valid cookie name; results are + unpredictable if you use a name containing unusual characters. + Valid characters include A-Z, a-z, 0-9, "_", and "-".
+This directive controls the format of the cookie header + field. The three formats allowed are:
+ +Not all clients can understand all of these formats. but you + should use the newest one that is generally acceptable to your + users' browsers.
+When the user track module is compiled in, and + "CookieTracking on" is set, Apache will start sending a + user-tracking cookie for all new requests. This directive can + be used to turn this behavior on or off on a per-server or + per-directory basis. By default, compiling mod_usertrack will + not activate cookies.
+ +This module creates dynamically configured virtual hosts, by
+ allowing the IP address and/or the Host:
header of
+ the HTTP request to be used as part of the pathname to
+ determine what files to serve. This allows for easy use of a
+ huge number of virtual hosts with similar configurations.
All the directives in this module interpolate a string into
+ a pathname. The interpolated string (henceforth called the
+ "name") may be either the server name (see the UseCanonicalName
+ directive for details on how this is determined) or the IP
+ address of the virtual host on the server in dotted-quad
+ format. The interpolation is controlled by specifiers inspired
+ by printf
which have a number of formats:
%% |
+insert a % |
%p |
+insert the port number of the virtual host |
%N.M |
+insert (part of) the name |
N
and M
are used to specify
+ substrings of the name. N
selects from the
+ dot-separated components of the name, and M
+ selects characters within whatever N
has selected.
+ M
is optional and defaults to zero if it isn't
+ present; the dot must be present if and only if M
+ is present. The interpretation is as follows:
0 |
+ the whole name |
1 |
+ the first part |
2 |
+ the second part |
-1 |
+ the last part |
-2 |
+ the penultimate part |
2+ |
+ the second and all subsequent parts |
-2+ |
+ the penultimate and all preceding parts |
1+ and -1+ |
+ the same as 0 |
If N
or M
is greater than the number
+ of parts available a single underscore is interpolated.
For simple name-based virtual hosts you might use the + following directives in your server configuration file:
+ +A request for
+ http://www.example.com/directory/file.html
will be
+ satisfied by the file
+ /usr/local/apache/vhosts/www.example.com/directory/file.html
.
+
For a very large number of virtual hosts it is a good idea
+ to arrange the files to reduce the size of the
+ vhosts
directory. To do this you might use the
+ following in your configuration file:
A request for
+ http://www.example.isp.com/directory/file.html
+ will be satisfied by the file
+ /usr/local/apache/vhosts/isp.com/e/x/a/example/directory/file.html
.
A more even spread of files can be achieved by hashing from the + end of the name, for example:
+ +The example request would come from
+ /usr/local/apache/vhosts/isp.com/e/l/p/example/directory/file.html
.
Alternatively you might use:
+ +The example request would come from
+ /usr/local/apache/vhosts/isp.com/e/x/a/mple/directory/file.html
.
For IP-based virtual hosting you might use the following in + your configuration file:
+ +A request for
+ http://www.example.isp.com/directory/file.html
+ would be satisfied by the file
+ /usr/local/apache/vhosts/10/20/30/40/docs/directory/file.html
+ if the IP address of www.example.com
were
+ 10.20.30.40. A request for
+ http://www.example.isp.com/cgi-bin/script.pl
would
+ be satisfied by executing the program
+ /usr/local/apache/vhosts/10/20/30/40/cgi-bin/script.pl
.
If you want to include the .
character in a
+ VirtualDocumentRoot
directive, but it clashes with
+ a %
directive, you can work around the problem in
+ the following way:
A request for
+ http://www.example.isp.com/directory/file.html
+ will be satisfied by the file
+ /usr/local/apache/vhosts/example.isp/directory/file.html
.
The %V
and %A
are useful
+ in conjunction with this module.
The VirtualDocumentRoot
directive allows you to
+ determine where Apache will find your documents based on the
+ value of the server name. The result of expanding
+ interpolated-directory is used as the root of the
+ document tree in a similar manner to the none
then
+ VirtaulDocumentRoot
is turned off. This directive
+ cannot be used in the same context as
+
The VirtualDocumentRootIP
directive is like the
+
The VirtualScriptAlias
directive allows you to
+ determine where Apache will find CGI scripts in a similar
+ manner to /cgi-bin/
, much like /cgi-bin/
would.
The VirtualScriptAliasIP
directive is like the
+ VirtualScriptAlias
+ directive, except that it uses the IP address of the server end
+ of the connection instead of the server name.
This controls the directory to which Apache attempts to
+ switch before dumping core. The default is in the
+
The
It is recommended that you set up a new group specifically for
+ running the server. Some admins use user nobody
,
+ but this is not always possible or desirable.
Note: if you start the server as a non-root user, it will + fail to change to the specified group, and will instead + continue to run as the group of the original user.
+ +Special note: Use of this directive in <VirtualHost< is
+ no longer supported. To implement the suEXEC wrapper with Apache 2.0, use the
+
The
It is often useful to be able to send the server a signal,
+ so that it closes and then reopens its
The PidFile is subject to the same warnings about log file + placement and security.
+The
The Listen directive tells the server to accept incoming + requests on the specified port or address-and-port combination. + If only a port number is specified, the server listens to the + given port on all interfaces. If an IP address is given as well + as a port, the server will listen on the given port and + interface.
+ +Multiple Listen directives may be used to specify a number + of addresses and ports to listen to. The server will respond to + requests from any of the listed addresses and ports.
+ +For example, to make the server accept connections on both + port 80 and port 8000, use:
+The maximum length of the queue of pending connections.
+ Generally no tuning is needed or desired, however on some
+ systems it is desirable to increase this when under a TCP SYN
+ flood attack. See the backlog parameter to the
+ listen(2)
system call.
This will often be limited to a smaller number by the + operating system. This varies from OS to OS. Also note that + many OSes do not use exactly what is specified as the backlog, + but use a number based on (but normally larger than) what is + set.
+The logs
directory is
+ NFS mounted, since the lockfile must be stored on a local
+ disk. The PID of the main server process is
+ automatically appended to the filename.
SECURITY: It is best to avoid putting this
+ file in a world writable directory such as
+ /var/tmp
because someone could create a denial of
+ service attack and prevent the server from starting by creating
+ a lockfile with the same name as the one the server will try to
+ create.
The
Any connection attempts over the
+
When the server is compiled with threading, then the maximum
+ number of simultaneous requests that can be served is obtained
+ from the value of this directive multiplied by
+
The
Setting
NOTE: For KeepAlive requests, only + the first request is counted towards this limit. In effect, it + changes the behavior to limit the number of + connections per child.
+Maximum number of idle threads. Different MPMs deal with this
+ directive differently.
Maximum number of threads per child. For MPMs with a
+ variable number of threads per child, this directive sets the
+ maximum number of threads that will be created in each child
+ process. To increase this value beyond its default, it is
+ necessary to change the value of the compile-time define
+ HARD_THREAD_LIMIT
and recompile the server.
Minimum number of idle threads to handle request spikes.
+ Different MPMs deal with this directive
+ differently.
Number of children alive at the same time. MPMs that use + this directive do not dynamically create new child processes so + this number should be large enough to handle the requests for + the entire site.
+The
If you have to use a
The server will set the TCP buffer size to the number of bytes + specified. Very useful to increase past standard OS defaults on + high speed high latency (i.e., 100ms or so, such as + transcontinental fast pipes).
+For the
Special care must be taken when using this directive. If
+
With the
With the
The
Number of threads each child creates on startup. As the + number of threads is dynamically controlled depending on the + load, there is usually little reason to adjust this + parameter.
+This directive sets the maximum configured value for
Special care must be taken when using this directive. If
+
Use this directive only if you need to set
This directive sets the number of threads created by each + child process. The child creates these threads at startup and + never creates more. if using an MPM like mpmt_winnt, where + there is only one child process, this number should be high + enough to handle the entire load of the server. If using an MPM + like worker, where there are multiple child processes, the + total number of threads should be high enough to handle the + common load on the server.
+The
The user should have no privileges which result in it being
+ able to access files which are not intended to be visible to the
+ outside world, and similarly, the user should not be able to
+ execute code which is not meant for httpd requests. It is
+ recommended that you set up a new user and group specifically for
+ running the server. Some admins use user nobody
, but
+ this is not always possible or desirable. For example
+
Notes: If you start the server as a non-root user, it will + fail to change to the lesser privileged user, and will instead + continue to run as that original user. If you do start the + server as root, then it is normal for the parent process to + remain running as root.
+ +Special note: Use of this directive in
Don't set root
unless you know exactly what you are doing, and what
+the dangers are.
This Multi-Processing Module implements an exclusively threaded web + server optimized for Novell NetWare.
+ +Status: MPM
+ Source File: mpm_netware.c
+ Module Identifier:
+ mpm_netware_module
This Multi-Processing Module (MPM) implements an exclusively threaded web server + that has been optimized for Novell NetWare.
+ +The main thread is responsible for launching child + worker threads which listen for connections and serve them when they + arrive. Apache always tries to maintain several spare + or idle worker threads, which stand ready to serve incoming + requests. In this way, clients do not need to wait for a new + child threads to be spawned before their requests can be + served.
+ +The StartThreads
, MinSpareThreads
,
+ MaxSpareThreads
, and MaxThreads
+ regulate how the main thread creates worker threads to serve
+ requests. In general, Apache is very self-regulating, so most
+ sites do not need to adjust these directives from their default
+ values. Sites which need to serve more than 250 simultaneous
+ requests may need to increase MaxThreads
, while
+ sites with limited memory may need to decrease
+ MaxThreads
to keep the server from thrashing (spawning and
+ terminating idle threads). More information about
+ tuning process creation is provided in the performance hints
+ documentation.
MaxRequestsPerChild
controls how frequently the
+ server recycles processes by killing old ones and launching new
+ ones. On the NetWare OS it is highly recommended that this directive
+ remain set to 0. This allows worker threads to continue servicing
+ requests indefinitely.
See also: Setting which addresses and + ports Apache uses.
+ +MaxThreads 250
The MaxThreads directive sets the desired maximum + number worker threads allowable.
+ +See also MinSpareThreads, MaxSpareThreads and + StartThreads.
+MaxSpareThreads 100
The MaxSpareThreads directive sets the desired maximum + number of idle worker threads. An idle worker thread + is one which is not handling a request. If there are more than + MaxSpareThreads idle, then the main thread will kill off the + excess worker threads.
+ +Tuning of this parameter should only be necessary on very + busy sites. Setting this parameter to a large number is almost + always a bad idea.
+ +See also MinSpareThreads, MaxThreads and + StartThreads.
+MinSpareThreads 10
The MinSpareThreads directive sets the desired minimum + number of idle worker threads. An idle worker thread + is one which is not handling a request. If there are fewer than MinSpareThreads idle, then the + main thread spawns new worker.
+ +Tuning of this parameter should only be necessary on very + busy sites. Setting this parameter to a large number is almost + always a bad idea.
+ +See also MaxSpareThreads, MaxThreads and + StartThreads. +
StartThreads
+ 50
The StartThreads directive sets the desired + number of worker threads to spawn and startup.
+ +See also MaxSpareThreads, MinSpareThreads + and MaxThreads. +
ThreadStackSize
+ 65536
This directive tells the server what stack size to use for + each of the running threads. If you ever get a stack overflow + you will need to bump this number to a higher setting.
+ +This Multi-Processing Module (MPM) implements an exclusively threaded web server + that has been optimized for Novell NetWare.
+ +The main thread is responsible for launching child + worker threads which listen for connections and serve them when they + arrive. Apache always tries to maintain several spare + or idle worker threads, which stand ready to serve incoming + requests. In this way, clients do not need to wait for a new + child threads to be spawned before their requests can be + served.
+ +The StartThreads
, MinSpareThreads
,
+ MaxSpareThreads
, and MaxThreads
+ regulate how the main thread creates worker threads to serve
+ requests. In general, Apache is very self-regulating, so most
+ sites do not need to adjust these directives from their default
+ values. Sites which need to serve more than 250 simultaneous
+ requests may need to increase MaxThreads
, while
+ sites with limited memory may need to decrease
+ MaxThreads
to keep the server from thrashing (spawning and
+ terminating idle threads). More information about
+ tuning process creation is provided in the performance hints
+ documentation.
MaxRequestsPerChild
controls how frequently the
+ server recycles processes by killing old ones and launching new
+ ones. On the NetWare OS it is highly recommended that this directive
+ remain set to 0. This allows worker threads to continue servicing
+ requests indefinitely.
The MaxThreads directive sets the desired maximum + number worker threads allowable.
+The
Tuning of this parameter should only be necessary on very + busy sites. Setting this parameter to a large number is almost + always a bad idea.
+The
Tuning of this parameter should only be necessary on very + busy sites. Setting this parameter to a large number is almost + always a bad idea.
+The StartThreads directive sets the desired + number of worker threads to spawn and startup
+This directive tells the server what stack size to use for + each of the running threads. If you ever get a stack overflow + you will need to bump this number to a higher setting.
+This Multi-Processing Module (MPM) is the default for the + Windows NT operating systems. It uses a single control process + which launches a single child process which in turn creates + threads to handle requests
+This Multi-Processing Module (MPM) implements a hybrid + multi-process, multi-threaded web server. A fixed number of + processes create threads to handle requests. Fluctuations in + load are handled by increasing or decreasing the number of + threads in each process.
+ +A single control process launches the number of child processes
+ indicated by the StartThreads
directive. The individual threads then
+ listen for connections and serve them when they arrive.
Apache always tries to maintain a pool of spare or
+ idle server threads, which stand ready to serve incoming
+ requests. In this way, clients do not need to wait for new
+ threads to be created. For each child process, Apache assesses
+ the number of idle threads and creates or destroys threads to
+ keep this number within the boundaries specified by
+ MinSpareThreads
and MaxSpareThreads
.
+ Since this process is very self-regulating, it is rarely
+ necessary to modify these directives from their default values.
+ The maximum number of clients that may be served simultaneously
+ is determined by multiplying the number of server processes
+ that will be created (NumServers
) by the maximum
+ number of threads created in each process
+ (MaxThreadsPerChild
).
While the parent process is usually started as root under
+ Unix in order to bind to port 80, the child processes and
+ threads are launched by Apache as a less-privileged user. The
+ User
and Group
directives are used to
+ set the privileges of the Apache child processes. The child
+ processes must be able to read all the content that will be
+ served, but should have as few privileges beyond that as
+ possible. In addition, unless suexec is used, these directives also
+ set the privileges which will be inherited by CGI scripts.
MaxRequestsPerChild
controls how frequently the
+ server recycles processes by killing old ones and launching new
+ ones.
See also: Setting which addresses and + ports Apache uses.
+ +In addition it adds the extra ability to specify that + specific processes should serve requests under different + userids. These processes can then be associated with specific + virtual hosts.
+ +Tie a virtual host to a specific child process. Requests addressed to +the virtual host where this directive appears will be served by the process +running with the specified user and group id.
+Specify a user id and group id for a specific child process. The number of +children if set by the NumServers +directive. For example, the default value for NumServers is 5 and that means +children ids 1,2,3,4 and 5 are available for assigment. If a child does not +have an associated ChildPerUserID, it inherits the User and Group settings from the main server
+This Multi-Processing Module (MPM) implements a + non-threaded, pre-forking web server which handles request in a + manner very similar to the default behavior of Apache 1.3 on + Unix.
+ +A single control process is responsible for launching child + processes which listen for connections and serve them when they + arrive. Apache always tries to maintain several spare + or idle server processes, which stand ready to serve incoming + requests. In this way, clients do not need to wait for a new + child processes to be forked before their requests can be + served.
+ +The
While the parent process is usually started as root under Unix
+ in order to bind to port 80, the child processes are launched by
+ Apache as a less-privileged user. The
The
If this directive is set to default
, then the
+ compile-time selected default will be used. Other possible
+ methods are listed below. Note that not all methods are
+ available on all platforms. If a method is specified which is
+ not available, a message will be written to the error log
+ listing the available methods.
flock
flock(2)
system call to lock the
+ file defined by the fcntl
fnctl(2)
system call to lock the
+ file defined by the sysvsem
pthread
The
Tuning of this parameter should only be necessary on very + busy sites. Setting this parameter to a large number is almost + always a bad idea.
+The
Tuning of this parameter should only be necessary on very + busy sites. Setting this parameter to a large number is almost + always a bad idea.
+ +This directive has no effect on Microsoft Windows.
+This Multi-Processing Module implements a hybrid + multi-threaded multi-process web server.
+ +Status: MPM
+ Source File: worker.c
+ Module Identifier:
+ mpm_worker_module
This Multi-Processing Module (MPM) is the default for most + unix-like operating systems. It implements a hybrid + multi-process multi-threaded server. Each process has a fixed + number of threads. The server adjusts to handle load by + increasing or decreasing the number of processes.
+ +A single control process is responsible for launching child
+ processes. Each child process creates a fixed number of threads
+ as specified in the ThreadsPerChild
directive. The
+ individual threads then listen for connections and serve them
+ when they arrive.
Apache always tries to maintain a pool of spare or
+ idle server threads, which stand ready to serve incoming
+ requests. In this way, clients do not need to wait for a new
+ threads or processes to be created before their requests can be
+ served. Apache assesses the total number of idle threads in all
+ processes, and forks or kills processes to keep this number
+ within the boundaries specified by MinSpareThreads
+ and MaxSpareThreads
. Since this process is very
+ self-regulating, it is rarely necessary to modify these
+ directives from their default values. The maximum number of
+ clients that may be served simultaneously is determined by
+ multiplying the maximum number of server processes that will be
+ created (MaxClients
) by the number of threads
+ created in each process (ThreadsPerChild
).
While the parent process is usually started as root under
+ Unix in order to bind to port 80, the child processes and
+ threads are launched by Apache as a less-privileged user. The
+ User
and Group
directives are used to
+ set the privileges of the Apache child processes. The child
+ processes must be able to read all the content that will be
+ served, but should have as few privileges beyond that as
+ possible. In addition, unless suexec is used, these directives also
+ set the privileges which will be inherited by CGI scripts.
MaxRequestsPerChild
controls how frequently the
+ server recycles processes by killing old ones and launching new
+ ones.
See also: Setting which addresses and + ports Apache uses.
+ +This Multi-Processing Module (MPM) is the default for most + unix-like operating systems. It implements a hybrid + multi-process multi-threaded server. Each process has a fixed + number of threads. The server adjusts to handle load by + increasing or decreasing the number of processes.
+ +A single control process is responsible for launching child
+ processes. Each child process creates a fixed number of threads
+ as specified in the ThreadsPerChild
directive. The
+ individual threads then listen for connections and serve them
+ when they arrive.
Apache always tries to maintain a pool of spare or
+ idle server threads, which stand ready to serve incoming
+ requests. In this way, clients do not need to wait for a new
+ threads or processes to be created before their requests can be
+ served. Apache assesses the total number of idle threads in all
+ processes, and forks or kills processes to keep this number
+ within the boundaries specified by MinSpareThreads
+ and MaxSpareThreads
. Since this process is very
+ self-regulating, it is rarely necessary to modify these
+ directives from their default values. The maximum number of
+ clients that may be served simultaneously is determined by
+ multiplying the maximum number of server processes that will be
+ created (MaxClients
) by the number of threads
+ created in each process (ThreadsPerChild
).
While the parent process is usually started as root under
+ Unix in order to bind to port 80, the child processes and
+ threads are launched by Apache as a less-privileged user. The
+ User
and Group
directives are used to
+ set the privileges of the Apache child processes. The child
+ processes must be able to read all the content that will be
+ served, but should have as few privileges beyond that as
+ possible. In addition, unless suexec is used, these directives also
+ set the privileges which will be inherited by CGI scripts.
MaxRequestsPerChild
controls how frequently the
+ server recycles processes by killing old ones and launching new
+ ones.
übersetzt von simon.putz@t-online.de
+ + +
+ +
|
+
+ +
|
+
+ ![]() +
+
+
+
+The idea in mod_ssl is mainly the following: because mod_ssl provides mostly a +superset of the functionality of all other solutions we can easily provide +backward compatibility for most of the cases. Actually there are three +compatibility areas we currently address: configuration directives, +environment variables and custom log functions. + Configuration Directives+For backward compatibility to the configuration directives of other SSL +solutions we do an on-the-fly mapping: directives which have a direct +counterpart in mod_ssl are mapped silently while other directives lead to a +warning message in the logfiles. The currently implemented directive mapping +is listed in Table 1. Currently full backward +compatibilty is provided only for Apache-SSL 1.x and mod_ssl 2.0.x. +Compatibility to Sioux 1.x and Stronghold 2.x is only partial because of +special functionality in these interfaces which mod_ssl (still) doesn't +provide. ++
+
+
+
+ Environment Variables+When you use ``SSLOptions +CompatEnvVars '' additional environment
+variables are generated. They all correspond to existing official mod_ssl
+variables. The currently implemented variable derivation is listed in Table 2.
++
+
+
+
+ Custom Log Functions+When mod_ssl is built into Apache or at least loaded (under DSO situation) +additional functions exist for the Custom Log Format of mod_log_config as documented in the Reference +Chapter. Beside the ``%{ varname}x ''
+eXtension format function which can be used to expand any variables provided
+by any module, an additional Cryptography
+``%{ name}c '' cryptography format function
+exists for backward compatibility. The currently implemented function calls
+are listed in Table 3.
++
+
+
+
+
|
+
+ ![]() +
+
+
+ About the module+
+
+ About Installation+
+
+ About Configuration+
+
+ About Certificates+
+
+ About SSL Protocol+
+
+ About Support+
+
+
|
+
+ ![]() +
+
+
+
Cipher Suites and Enforced Strong Security+
+ Client Authentication and Access Control+
+
+
|
+
+ ![]() +
+
+
+
Cryptographic Techniques+Understanding SSL requires an understanding of cryptographic algorithms, +message digest functions (aka. one-way or hash functions), and digital +signatures. These techniques are the subject of entire books (see for instance +[AC96]) and provide the basis for privacy, integrity, and +authentication. +Cryptographic Algorithms+Suppose Alice wants to send a message to her bank to transfer some money. +Alice would like the message to be private, since it will include information +such as her account number and transfer amount. One solution is to use a +cryptographic algorithm, a technique that would transform her message into an +encrypted form, unreadable except by those it is intended for. Once in this +form, the message may only be interpreted through the use of a secret key. +Without the key the message is useless: good cryptographic algorithms make it +so difficult for intruders to decode the original text that it isn't worth +their effort. ++There are two categories of cryptographic algorithms: +conventional and public key. +
Message Digests+Although Alice may encrypt her message to make it private, there is still a +concern that someone might modify her original message or substitute +it with a different one, in order to transfer the money to themselves, for +instance. One way of guaranteeing the integrity of Alice's message is to +create a concise summary of her message and send this to the bank as well. +Upon receipt of the message, the bank creates its own summary and compares it +with the one Alice sent. If they agree then the message was received intact. ++A summary such as this is called a message digest, one-way +function or hash function. Message digests are used to create +short, fixed-length representations of longer, variable-length messages. +Digest algorithms are designed to produce unique digests for different +messages. Message digests are designed to make it too difficult to determine +the message from the digest, and also impossible to find two different +messages which create the same digest -- thus eliminating the possibility of +substituting one message for another while maintaining the same digest. + +Another challenge that Alice faces is finding a way to send the digest to the +bank securely; when this is achieved, the integrity of the associated message +is assured. One way to to this is to include the digest in a digital +signature. + Digital Signatures+When Alice sends a message to the bank, the bank needs to ensure that the +message is really from her, so an intruder does not request a transaction +involving her account. A digital signature, created by Alice and +included with the message, serves this purpose. ++Digital signatures are created by encrypting a digest of the message, +and other information (such as a sequence number) with the sender's +private key. Though anyone may decrypt the signature using the public +key, only the signer knows the private key. This means that only they may +have signed it. Including the digest in the signature means the signature is +only good for that message; it also ensures the integrity of the message since +no one can change the digest and still sign it. + +To guard against interception and reuse of the signature by an intruder at a +later date, the signature contains a unique sequence number. This protects +the bank from a fraudulent claim from Alice that she did not send the message +-- only she could have signed it (non-repudiation). + Certificates+Although Alice could have sent a private message to the bank, signed it, and +ensured the integrity of the message, she still needs to be sure that she is +really communicating with the bank. This means that she needs to be sure that +the public key she is using corresponds to the bank's private key. Similarly, +the bank also needs to verify that the message signature really corresponds to +Alice's signature. ++If each party has a certificate which validates the other's identity, confirms +the public key, and is signed by a trusted agency, then they both will be +assured that they are communicating with whom they think they are. Such a +trusted agency is called a Certificate Authority, and certificates are +used for authentication. + Certificate Contents+A certificate associates a public key with the real identity of an individual, +server, or other entity, known as the subject. As shown in Table 1, information about the subject includes identifying +information (the distinguished name), and the public key. It also includes +the identification and signature of the Certificate Authority that issued the +certificate, and the period of time during which the certificate is valid. It +may have additional information (or extensions) as well as administrative +information for the Certificate Authority's use, such as a serial number. ++
+
+
+
+A distinguished name is used to provide an identity in a specific context -- +for instance, an individual might have a personal certificate as well as one +for their identity as an employee. Distinguished names are defined by the +X.509 standard [X509], which defines the fields, field +names, and abbreviations used to refer to the fields +(see Table 2). + +
+
+
+
+A Certificate Authority may define a policy specifying which distinguished
+field names are optional, and which are required. It may also place
+requirements upon the field contents, as may users of certificates. As an
+example, a Netscape browser requires that the Common Name for a certificate
+representing a server has a name which matches a wildcard pattern for the
+domain name of that server, such as +The binary format of a certificate is defined using the ASN.1 notation [ X208] [PKCS]. This notation defines how to +specify the contents, and encoding rules define how this information is +translated into binary form. The binary encoding of the certificate is +defined using Distinguished Encoding Rules (DER), which are based on the more +general Basic Encoding Rules (BER). For those transmissions which cannot +handle binary, the binary form may be translated into an ASCII form by using +Base64 encoding [MIME]. This encoded version is called PEM +encoded (the name comes from "Privacy Enhanced Mail"), when placed between +begin and end delimiter lines as illustrated in Table 3. + +
+
+
+
Certificate Authorities+By first verifying the information in a certificate request before granting +the certificate, the Certificate Authority assures the identity of the private +key owner of a key-pair. For instance, if Alice requests a personal +certificate, the Certificate Authority must first make sure that Alice really +is the person the certificate request claims. +Certificate Chains+A Certificate Authority may also issue a certificate for another Certificate +Authority. When examining a certificate, Alice may need to examine the +certificate of the issuer, for each parent Certificate Authority, until +reaching one which she has confidence in. She may decide to trust only +certificates with a limited chain of issuers, to reduce her risk of a "bad" +certificate in the chain. +Creating a Root-Level CA+As noted earlier, each certificate requires an issuer to assert the validity +of the identity of the certificate subject, up to the top-level Certificate +Authority (CA). This presents a problem: Since this is who vouches for the +certificate of the top-level authority, which has no issuer? +In this unique case, the certificate is "self-signed", so the issuer of the +certificate is the same as the subject. As a result, one must exercise extra +care in trusting a self-signed certificate. The wide publication of a public +key by the root authority reduces the risk in trusting this key -- it would be +obvious if someone else publicized a key claiming to be the authority. +Browsers are preconfigured to trust well-known certificate authorities. ++A number of companies, such as Thawte and +VeriSign have established themselves as +Certificate Authorities. These companies provide the following services: +
+It is also possible to create your own Certificate Authority. Although risky +in the Internet environment, it may be useful within an Intranet where the +organization can easily verify the identities of individuals and servers. + Certificate Management+Establishing a Certificate Authority is a responsibility which requires a +solid administrative, technical, and management framework. +Certificate Authorities not only issue certificates, they also manage them -- +that is, they determine how long certificates are valid, they renew them, and +they keep lists of certificates that have already been issued but are no +longer valid (Certificate Revocation Lists, or CRLs). +Say Alice is entitled to a certificate as an employee of a company. Say too, +that the certificate needs to be revoked when Alice leaves the company. Since +certificates are objects that get passed around, it is impossible to tell from +the certificate alone that it has been revoked. +When examining certificates for validity, therefore, it is necessary to +contact the issuing Certificate Authority to check CRLs -- this is not usually +an automated part of the process. ++ Note:
+If you use a Certificate Authority that is not configured into browsers by
+default, it is necessary to load the Certificate Authority certificate into
+the browser, enabling the browser to validate server certificates signed by
+that Certificate Authority. Doing so may be dangerous, since once loaded, the
+browser will accept all certificates signed by that Certificate Authority.
+Secure Sockets Layer (SSL)+The Secure Sockets Layer protocol is a protocol layer which may be placed +between a reliable connection-oriented network layer protocol (e.g. TCP/IP) +and the application protocol layer (e.g. HTTP). SSL provides for secure +communication between client and server by allowing mutual authentication, the +use of digital signatures for integrity, and encryption for privacy. ++The protocol is designed to support a range of choices for specific algorithms +used for cryptography, digests, and signatures. This allows algorithm +selection for specific servers to be made based on legal, export or other +concerns, and also enables the protocol to take advantage of new algorithms. +Choices are negotiated between client and server at the start of establishing +a protocol session. + +
+
+
+
+There are a number of versions of the SSL protocol, as shown in Table 4. As noted there, one of the benefits in SSL 3.0 is +that it adds support of certificate chain loading. This feature allows a +server to pass a server certificate along with issuer certificates to the +browser. Chain loading also permits the browser to validate the server +certificate, even if Certificate Authority certificates are not installed for +the intermediate issuers, since they are included in the certificate chain. +SSL 3.0 is the basis for the Transport Layer Security [TLS] protocol standard, currently in development by the +Internet Engineering Task Force (IETF). + Session Establishment+The SSL session is established by following a handshake sequence +between client and server, as shown in Figure 1. This +sequence may vary, depending on whether the server is configured to provide a +server certificate or request a client certificate. Though cases exist where +additional handshake steps are required for management of cipher information, +this article summarizes one common scenario: see the SSL specification for the +full range of possibilities. ++ Note
+Once an SSL session has been established it may be reused, thus avoiding the
+performance penalty of repeating the many steps needed to start a session.
+For this the server assigns each SSL session a unique session identifier which
+is cached in the server and which the client can use on forthcoming
+connections to reduce the handshake (until the session identifer expires in
+the cache of the server).
++ ++The elements of the handshake sequence, as used by the client and server, are +listed below: +
+The first step, Cipher Suite Negotiation, allows the client and server to +choose a Cipher Suite supportable by both of them. The SSL3.0 protocol +specification defines 31 Cipher Suites. A Cipher Suite is defined by the +following components: +
Key Exchange Method+The key exchange method defines how the shared secret symmetric cryptography +key used for application data transfer will be agreed upon by client and +server. SSL 2.0 uses RSA key exchange only, while SSL 3.0 supports a choice of +key exchange algorithms including the RSA key exchange when certificates are +used, and Diffie-Hellman key exchange for exchanging keys without certificates +and without prior communication between client and server. ++One variable in the choice of key exchange methods is digital signatures -- +whether or not to use them, and if so, what kind of signatures to use. +Signing with a private key provides assurance against a +man-in-the-middle-attack during the information exchange used in generating +the shared key [AC96, p516]. + Cipher for Data Transfer+SSL uses the conventional cryptography algorithm (symmetric cryptography) +described earlier for encrypting messages in a session. There are nine +choices, including the choice to perform no encryption: +
Digest Function+The choice of digest function determines how a digest is created from a record +unit. SSL supports the following: +
Handshake Sequence Protocol+The handshake sequence uses three protocols: +
+ ++The encapsulation of SSL control protocols by the record protocol means that +if an active session is renegotiated the control protocols will be transmitted +securely. If there were no session before, then the Null cipher suite is +used, which means there is no encryption and messages have no integrity +digests until the session has been established. + Data Transfer+The SSL Record Protocol, shown in Figure 3, is used to +transfer application and SSL Control data between the client and server, +possibly fragmenting this data into smaller units, or combining multiple +higher level protocol data messages into single units. It may compress, attach +digest signatures, and encrypt these units before transmitting them using the +underlying reliable transport protocol (Note: currently all major SSL +implementations lack support for compression). ++ +Securing HTTP Communication+One common use of SSL is to secure Web HTTP communication between a browser +and a webserver. This case does not preclude the use of non-secured HTTP. The +secure version is mainly plain HTTP over SSL (named HTTPS), but with one major +difference: it uses the URL schemehttps rather than
+http and a different server port (by default 443). This mainly
+is what mod_ssl provides to you for the Apache webserver...
+References+
+
+
|
+
+pcregrep - a grep with Perl-compatible regular expressions. +
++pcregrep [-Vcfhilnrsvx] pattern [file] ... +
++pcregrep searches files for character patterns, in the same way as other +grep commands do, but it uses the PCRE regular expression library to support +patterns that are compatible with the regular expressions of Perl 5. See +pcre(3) for a full description of syntax and semantics. +
++If no files are specified, pcregrep reads the standard input. By default, +each line that matches the pattern is copied to the standard output, and if +there is more than one file, the file name is printed before each line of +output. However, there are options that can change how pcregrep behaves. +
++Lines are limited to BUFSIZ characters. BUFSIZ is defined in <stdio.h>. +The newline character is removed from the end of each line before it is matched +against the pattern. +
++-V +Write the version number of the PCRE library being used to the standard error +stream. +
++-c +Do not print individual lines; instead just print a count of the number of +lines that would otherwise have been printed. If several files are given, a +count is printed for each of them. +
++\fB-ffilename +Read patterns from the file, one per line, and match all patterns against each +line. There is a maximum of 100 patterns. Trailing white space is removed, and +blank lines are ignored. An empty file contains no patterns and therefore +matches nothing. +
++-h +Suppress printing of filenames when searching multiple files. +
++-i +Ignore upper/lower case distinctions during comparisons. +
++-l +Instead of printing lines from the files, just print the names of the files +containing lines that would have been printed. Each file name is printed +once, on a separate line. +
++-n +Precede each line by its line number in the file. +
++-r +If any file is a directory, recursively scan the files it contains. Without +-r a directory is scanned as a normal file. +
++-s +Work silently, that is, display nothing except error messages. +The exit status indicates whether any matches were found. +
++-v +Invert the sense of the match, so that lines which do not match the +pattern are now the ones that are found. +
++-x +Force the pattern to be anchored (it must start matching at the beginning of +the line) and in addition, require it to match the entire line. This is +equivalent to having ^ and $ characters at the start and end of each +alternative branch in the regular expression. +
++pcre(3), Perl 5 documentation +
++Exit status is 0 if any matches were found, 1 if no matches were found, and 2 +for syntax errors or inacessible files (even if matches were found). +
++Philip Hazel <ph10@cam.ac.uk> +
+
+Last updated: 15 August 2001
+
+pcretest - a program for testing Perl-compatible regular expressions.
+
+pcretest [-d] [-i] [-m] [-o osize] [-p] [-t] [source] [destination]
+
+pcretest was written as a test program for the PCRE regular expression
+library itself, but it can also be used for experimenting with regular
+expressions. This man page describes the features of the test program; for
+details of the regular expressions themselves, see the pcre man page.
+
+-d
+Behave as if each regex had the /D modifier (see below); the internal
+form is output after compilation.
+
+-i
+Behave as if each regex had the /I modifier; information about the
+compiled pattern is given after compilation.
+
+-m
+Output the size of each compiled pattern after it has been compiled. This is
+equivalent to adding /M to each regular expression. For compatibility with
+earlier versions of pcretest, -s is a synonym for -m.
+
+-o osize
+Set the number of elements in the output vector that is used when calling PCRE
+to be osize. The default value is 45, which is enough for 14 capturing
+subexpressions. The vector size can be changed for individual matching calls by
+including \O in the data line (see below).
+
+-p
+Behave as if each regex has /P modifier; the POSIX wrapper API is used
+to call PCRE. None of the other options has any effect when -p is set.
+
+-t
+Run each compile, study, and match 20000 times with a timer, and output
+resulting time per compile or match (in milliseconds). Do not set -t with
+-m, because you will then get the size output 20000 times and the timing
+will be distorted.
+
+If pcretest is given two filename arguments, it reads from the first and
+writes to the second. If it is given only one filename argument, it reads from
+that file and writes to stdout. Otherwise, it reads from stdin and writes to
+stdout, and prompts for each line of input, using "re>" to prompt for regular
+expressions, and "data>" to prompt for data lines.
+
+The program handles any number of sets of input on a single input file. Each
+set starts with a regular expression, and continues with any number of data
+lines to be matched against the pattern. An empty line signals the end of the
+data lines, at which point a new regular expression is read. The regular
+expressions are given enclosed in any non-alphameric delimiters other than
+backslash, for example
+
+
+Copyright (c) 1997-2001 University of Cambridge.
diff --git a/srclib/pcre/doc/pcregrep.txt b/srclib/pcre/doc/pcregrep.txt
new file mode 100644
index 00000000000..16002284025
--- /dev/null
+++ b/srclib/pcre/doc/pcregrep.txt
@@ -0,0 +1,101 @@
+NAME
+ pcregrep - a grep with Perl-compatible regular expressions.
+
+
+
+SYNOPSIS
+ pcregrep [-Vcfhilnrsvx] pattern [file] ...
+
+
+
+DESCRIPTION
+ pcregrep searches files for character patterns, in the same
+ way as other grep commands do, but it uses the PCRE regular
+ expression library to support patterns that are compatible
+ with the regular expressions of Perl 5. See pcre(3) for a
+ full description of syntax and semantics.
+
+ If no files are specified, pcregrep reads the standard
+ input. By default, each line that matches the pattern is
+ copied to the standard output, and if there is more than one
+ file, the file name is printed before each line of output.
+ However, there are options that can change how pcregrep
+ behaves.
+
+ Lines are limited to BUFSIZ characters. BUFSIZ is defined in
+ pcretest specification
+This HTML document has been generated automatically from the original man page.
+If there is any nonsense in it, please consult the man page in case the
+conversion went wrong.
+
+
+
+ /(a|bc)x+yz/
+
+
+White space before the initial delimiter is ignored. A regular expression may +be continued over several input lines, in which case the newline characters are +included within it. It is possible to include the delimiter within the pattern +by escaping it, for example +
++
+ /abc\/def/ ++ +
+If you do so, the escape and the delimiter form part of the pattern, but since +delimiters are always non-alphameric, this does not affect its interpretation. +If the terminating delimiter is immediately followed by a backslash, for +example, +
++
+ /abc/\ ++ +
+then a backslash is added to the end of the pattern. This is done to provide a +way of testing the error condition that arises if a pattern finishes with a +backslash, because +
++
+ /abc\/ ++ +
+is interpreted as the first line of a pattern that starts with "abc/", causing +pcretest to read the next line as a continuation of the regular expression. +
++The pattern may be followed by i, m, s, or x to set the +PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, or PCRE_EXTENDED options, +respectively. For example: +
++
+ /caseless/i ++ +
+These modifier letters have the same effect as they do in Perl. There are +others which set PCRE options that do not correspond to anything in Perl: +/A, /E, and /X set PCRE_ANCHORED, PCRE_DOLLAR_ENDONLY, and +PCRE_EXTRA respectively. +
++Searching for all possible matches within each subject string can be requested +by the /g or /G modifier. After finding a match, PCRE is called +again to search the remainder of the subject string. The difference between +/g and /G is that the former uses the startoffset argument to +pcre_exec() to start searching at a new point within the entire string +(which is in effect what Perl does), whereas the latter passes over a shortened +substring. This makes a difference to the matching process if the pattern +begins with a lookbehind assertion (including \b or \B). +
++If any call to pcre_exec() in a /g or /G sequence matches an +empty string, the next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED +flags set in order to search for another, non-empty, match at the same point. +If this second match fails, the start offset is advanced by one, and the normal +match is retried. This imitates the way Perl handles such cases when using the +/g modifier or the split() function. +
++There are a number of other modifiers for controlling the way pcretest +operates. +
++The /+ modifier requests that as well as outputting the substring that +matched the entire pattern, pcretest should in addition output the remainder of +the subject string. This is useful for tests where the subject contains +multiple copies of the same substring. +
++The /L modifier must be followed directly by the name of a locale, for +example, +
++
+ /pattern/Lfr ++ +
+For this reason, it must be the last modifier letter. The given locale is set, +pcre_maketables() is called to build a set of character tables for the +locale, and this is then passed to pcre_compile() when compiling the +regular expression. Without an /L modifier, NULL is passed as the tables +pointer; that is, /L applies only to the expression on which it appears. +
++The /I modifier requests that pcretest output information about the +compiled expression (whether it is anchored, has a fixed first character, and +so on). It does this by calling pcre_fullinfo() after compiling an +expression, and outputting the information it gets back. If the pattern is +studied, the results of that are also output. +
++The /D modifier is a PCRE debugging feature, which also assumes /I. +It causes the internal form of compiled regular expressions to be output after +compilation. +
++The /S modifier causes pcre_study() to be called after the +expression has been compiled, and the results used when the expression is +matched. +
++The /M modifier causes the size of memory block used to hold the compiled +pattern to be output. +
++The /P modifier causes pcretest to call PCRE via the POSIX wrapper +API rather than its native API. When this is done, all other modifiers except +/i, /m, and /+ are ignored. REG_ICASE is set if /i is +present, and REG_NEWLINE is set if /m is present. The wrapper functions +force PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set. +
++The /8 modifier causes pcretest to call PCRE with the PCRE_UTF8 +option set. This turns on the (currently incomplete) support for UTF-8 +character handling in PCRE, provided that it was compiled with this support +enabled. This modifier also causes any non-printing characters in output +strings to be printed using the \x{hh...} notation if they are valid UTF-8 +sequences. +
++Before each data line is passed to pcre_exec(), leading and trailing +whitespace is removed, and it is then scanned for \ escapes. The following are +recognized: +
++
+ \a alarm (= BEL) + \b backspace + \e escape + \f formfeed + \n newline + \r carriage return + \t tab + \v vertical tab + \nnn octal character (up to 3 octal digits) + \xhh hexadecimal character (up to 2 hex digits) + \x{hh...} hexadecimal UTF-8 character ++ +
+
+ \A pass the PCRE_ANCHORED option to pcre_exec() + \B pass the PCRE_NOTBOL option to pcre_exec() + \Cdd call pcre_copy_substring() for substring dd + after a successful match (any decimal number + less than 32) + \Gdd call pcre_get_substring() for substring dd + after a successful match (any decimal number + less than 32) + \L call pcre_get_substringlist() after a + successful match + \N pass the PCRE_NOTEMPTY option to pcre_exec() + \Odd set the size of the output vector passed to + pcre_exec() to dd (any number of decimal + digits) + \Z pass the PCRE_NOTEOL option to pcre_exec() ++ +
+When \O is used, it may be higher or lower than the size set by the -O +option (or defaulted to 45); \O applies only to the call of pcre_exec() +for the line in which it appears. +
++A backslash followed by anything else just escapes the anything else. If the +very last character is a backslash, it is ignored. This gives a way of passing +an empty line as data, since a real empty line terminates the data input. +
++If /P was present on the regex, causing the POSIX wrapper API to be used, +only \B, and \Z have any effect, causing REG_NOTBOL and REG_NOTEOL +to be passed to regexec() respectively. +
++The use of \x{hh...} to represent UTF-8 characters is not dependent on the use +of the /8 modifier on the pattern. It is recognized always. There may be +any number of hexadecimal digits inside the braces. The result is from one to +six bytes, encoded according to the UTF-8 rules. +
++When a match succeeds, pcretest outputs the list of captured substrings that +pcre_exec() returns, starting with number 0 for the string that matched +the whole pattern. Here is an example of an interactive pcretest run. +
++
+ $ pcretest + PCRE version 2.06 08-Jun-1999 ++ +
+
+ re> /^abc(\d+)/ + data> abc123 + 0: abc123 + 1: 123 + data> xyz + No match ++ +
+If the strings contain any non-printing characters, they are output as \0x +escapes, or as \x{...} escapes if the /8 modifier was present on the +pattern. If the pattern has the /+ modifier, then the output for +substring 0 is followed by the the rest of the subject string, identified by +"0+" like this: +
++
+ re> /cat/+ + data> cataract + 0: cat + 0+ aract ++ +
+If the pattern has the /g or /G modifier, the results of successive +matching attempts are output in sequence, like this: +
++
+ re> /\Bi(\w\w)/g + data> Mississippi + 0: iss + 1: ss + 0: iss + 1: ss + 0: ipp + 1: pp ++ +
+"No match" is output only if the first match attempt fails. +
++If any of the sequences \C, \G, or \L are present in a +data line that is successfully matched, the substrings extracted by the +convenience functions are output with C, G, or L after the string number +instead of a colon. This is in addition to the normal full list. The string +length (that is, the return from the extraction function) is given in +parentheses after each string for \C and \G. +
++Note that while patterns can be continued over several lines (a plain ">" +prompt is used for continuations), data lines may not. However newlines can be +included in data by means of the \n escape. +
+
+Philip Hazel <ph10@cam.ac.uk>
+
+University Computing Service,
+
+New Museums Site,
+
+Cambridge CB2 3QG, England.
+
+Phone: +44 1223 334714
+
+Last updated: 15 August 2001
+
+Copyright (c) 1997-2001 University of Cambridge.
diff --git a/srclib/pcre/pcredemo.c b/srclib/pcre/pcredemo.c
new file mode 100644
index 00000000000..cb4e46f137d
--- /dev/null
+++ b/srclib/pcre/pcredemo.c
@@ -0,0 +1,94 @@
+#include