Apache other mod

最後更新: 2015-04-14

 

 


substitute_module

# Perform search and replace operations on response bodies

Syntax:    Substitute s/pattern/substitution/[infq]

e.g.

<Location /> 
    AddOutputFilterByType SUBSTITUTE text/html
    Substitute s/foo/bar/ni
</Location>
  • i       Perform a case-insensitive match
  • n       forces the pattern to be treated as a fixed string

 


dir_module

提供 DirectoryIndex 功能

 


info_module

.htaccess

<Location /server-info>
    SetHandler server-info
    Order allow,deny
    Allow from 127.0.0.1
</Location>

Usage:

http://your.host.example.com/server-info?config

  • ?<module-name>
  • ?config
  • ?hooks
  • ?list
  • ?server

screenshot:


usertrack_module

generates a 'clickstream' log of user activity on a site using cookies.

 


logio_module

# This module provides the logging of input and output number of bytes received/sent per request.
# actual bytes as received on the network,
# which then takes into account the headers and bodies of requests and responses.

two new logging directives.

%I
%O

 


headers_module

# This module provides directives to control and modify HTTP request and response headers.
# Headers can be merged, replaced or removed.

RequestHeader append MirrorID "mirror 12"
RequestHeader unset MirrorID

 


actions_module

    # executing CGI scripts based on media type or request method.
    # Files of a particular file extension
    AddHandler my-file-type .xyz
    Action my-file-type /cgi-bin/program.cgi
    
    # For <ISINDEX>-style searching
    Script GET /cgi-bin/search

 


version_module

Usage:

<IfVersion 2.1.0>
    # current httpd version is exactly 2.1.0
</IfVersion>

 


ext_filter_module

 

# provided that it allows the program to read from standard input and write to standard output

扮 substitute_module:

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

扮 deflate_module

# mod_ext_filter directive to define the external filter
ExtFilterDefine gzip mode=output cmd=/bin/gzip

<Location /gzipped>
    SetOutputFilter gzip
    Header set Content-Encoding gzip
</Location>

 


negotiation_module

 

The content negotiation and selecting the best representation of a resource.

More accurately content selection, is the selection of the document that best matches the clients capabilities.

Based on the browser-supplied preferences for media type, languages, character set and encoding.

Directive

* LanguagePriority

LanguagePriority en fr de

* ForceLanguagePriority

ForceLanguagePriority  Prefer Fallback

first matching variant from LanguagePriority will be served if more than one variant is acceptable

* MultiViews

If the server receives a request for /some/dir/foo and /some/dir/foo does not exist,
then the server reads the directory looking for all files named foo.*

A per-directory option

.htaccess    # Disable it

<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

 


usertrack_module

CustomLog        logs/clickstream "%{cookie}n %r %t"

# Apache will send a user-tracking cookie for all new requests.
# per-server or per-directory basis
# default the cookie is named "Apache".
# default cookies last only for the current browser session.(years, months, weeks, days, hours, minutes and seconds.)

CookieTracking   on
CookieName       Apache
CookieExpires    7 days

 


mod_deflate

AddOutputFilterByType  DEFLATE  text/html  text/plain text/xml

 


mod_negotiation

LanguagePriority

LanguagePriority en fr de

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.

 


mod_info

 

LoadModule info_module modules/mod_info.so

<Location /server-info>
    SetHandler server-info
</Location>

mod_speling

Attempts to correct mistaken URLs that users might have entered by ignoring capitalization and

by allowing up to one misspelling

CheckCaseOnly on
# Default: CheckCaseOnly Off

limits the action of the spelling correction to lower/upper case changes.


 

ext_filter_module

 

Pass the response body through an external program before delivery to the client

* reads from stdin and writes to stdout

Example:

ExtFilterDefine fixtext mode=output intype=text/html \
    cmd="/bin/sed s/verdana/arial/g"

<Location />
    SetOutputFilter fixtext
</Location>

# intype=imt
# Documents which should be filtered. By default, all documents are filtered.
#
# mode=input for filters which process the request


最少的 Module List

 

Centos 6.5 & Apache2.2

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule version_module modules/mod_version.so

 


 
 
 
 
 

Creative Commons license icon Creative Commons license icon