1. 程式人生 > >APACHE 模組 詳解

APACHE 模組 詳解

對configure引數的說明

配置幫助表:

-h, --help 顯示幫助資訊 display this help and exit
--help=short 用short引數將只顯示正在執行的當前指令碼的選項,而不能列出適用於Apache配置指令碼所執行的外部配置指令碼的選項 display options specific to this package
--help=recursive 使用recursive引數將顯示所有程式包的簡短描述 display the short help of all the included packages
-V, --version 顯示版本 display version information and exit
-q, --quiet, --silent 不顯示checking……資訊 do not print`checking...' messages
--cache-file=FILE
在指定檔案中儲存測試結果
cache test results in FILE [disabled]

-C, --config-cache
在檔案config.cache中儲存測試結果 alias for `--cache file=config.cache'
-n, --no-create configure指令碼執行結束後不輸出結果檔案,常用於正式編譯前的測試。 do not create output files
--srcdir=DIR 原始檔庫所在目錄 find the sources in DIR [configure dir or `..']

安裝目錄:

--prefix=PREFIX 體系無關檔案的頂級安裝目錄PREFIX ,也就Apache的安裝目錄 install architecture-independent files in PREFIX
[/usr/local/apache2]
--exec-prefix=EPREFIX 體系相關檔案的頂級安裝目錄EPREFIX ,把體系相關的檔案安裝到不同的位置可以方便地在不同主機之間共享體系相關的檔案 install architecture-dependent files in EPREFIX
[PREFIX]

預設情況下,make install 將會把所有檔案分別安裝到/usr/local/apache2/bin , /usr/local/apache2/lib 目錄下。可以用 --prefix 指定一個不同於/usr/local/apache2的安裝字首,比如:--prefix=$HOME 。
By default, `make install' will install all the files in
`/usr/local/apache2/bin', `/usr/local/apache2/lib' etc.  You can specify
an installation prefix other than `/usr/local/apache2' using `--prefix',
for instance `--prefix=$HOME'.

詳細安裝目錄設定:

預設安裝目錄參考config.layout,其中RHEL的預設目錄設定如下:
    prefix:        /usr
    exec_prefix:   ${prefix}
    bindir:        ${prefix}/bin
    sbindir:       ${prefix}/sbin
    libdir:        ${prefix}/lib
    libexecdir:    ${prefix}/lib/apache
    mandir:        ${prefix}/man
    sysconfdir:    /etc/httpd/conf
    datadir:       /var/www
    installbuilddir: ${datadir}/build
    errordir:      ${datadir}/error
    iconsdir:      ${datadir}/icons
    htdocsdir:     ${datadir}/html
    manualdir:     ${datadir}/manual
    cgidir:        ${datadir}/cgi-bin
    includedir:    ${prefix}/include/apache
    localstatedir: /var
    runtimedir:    ${localstatedir}/run
    logfiledir:    ${localstatedir}/log/httpd
    proxycachedir: ${localstatedir}/cache/httpd

自設定詳細安裝目錄

--bindir=DIR 使用者可執行目錄DIR。用於存放對網站管理員很有幫助的htpasswd, dbmmanage之類的支援程式 user executables [EPREFIX/bin]
--sbindir=DIR 系統管理員可執行目錄DIR ,用於存放執行HTTP伺服器所必須的httpd, apachectl, suexec之類的服務程式 system admin executables [EPREFIX/sbin]
--libexecdir=DIR 程式可執行目錄DIR ,也就是動態載入模組目錄 program executables [EPREFIX/libexec]
--sysconfdir=DIR 只讀的單一機器資料目錄DIR ,用於存放httpd.conf和mime.types之類的伺服器配置檔案 read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR 可改寫的體系無關資料目錄DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR 可改寫的單一機器資料目錄DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR 物件程式碼庫目錄DIR object code libraries [EPREFIX/lib]
--includedir=DIR Apache的C標頭檔案目錄DIR C header files [PREFIX/include]
--oldincludedir=DIR 非gcc的C標頭檔案目錄DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR Web伺服器只讀的體系無關資料根目錄 read-only arch.-independent data root [PREFIX/share]
--datadir=DIR Web伺服器只讀的體系無關資料目錄DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR 資訊文件目錄DIR info documentation [DATAROOTDIR/info]
--localedir=DIR 地區相關資料DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR 手冊文件目錄DIR man documentation [DATAROOTDIR/man]
--docdir=DIR 手冊目錄 documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR HTML格式幫助文件目錄 html documentation [DOCDIR]
--dvidir=DIR dvi格式幫助文件目錄 dvi documentation [DOCDIR]
--pdfdir=DIR pdf格式幫助文件目錄 pdf documentation [DOCDIR]
--psdir=DIR ps格式幫助文件目錄 ps documentation [DOCDIR]

交叉編譯選項:

這些選項用於交叉編譯在其他平臺上執行的Apache HTTP伺服器。在同一平臺上編譯和執行Apache HTTP伺服器通常不需要使用這些選項,指令碼會自動檢測並設定。

--build=BUILD 指定編譯工具所在系統的系統型別BUILD configure for building on BUILD [guessed]
--host=HOST 指定Apache HTTP伺服器將要進行交叉編譯時執行的目標系統型別HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET 指定交叉編譯所產生的目的碼型別 configure for building compilers for TARGET [HOST]

特徵選項:

--disable-option-checking 忽略無法識別的enable或with選項 ignore unrecognized --enable/--with options
--disable-FEATURE 不使用任何軟體特性 do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] 使用軟體特性 include FEATURE [ARG=yes]
--enable-layout=LAYOUT 預定義的安裝路徑佈局。選項使用config.layout檔案中的配置。只使用"--enable-layout", 而不指定LAYOUT, 相當於"--enable-layout=Apache"
--enable-v4-mapped 使用相同的套接字同時處理IPv4和IPv6的連線,也就是啟用地址對映。在FreeBSD、NetBSD、OpenBSD以外的平臺上是預設值。 Allow IPv6 sockets to handle IPv4 connections
--enable-exception-hook 允許在子程序崩潰以後啟用一個鉤子來執行異常處理程式。 Enable fatal exception hook
--enable-maintainer-mode 使用所有警告和除錯符號編譯原始碼,請勿用於正式伺服器,它會影響效能。 Turn on debugging and compile time warnings



--enable-pie
 
編譯http作為一個獨立的可執行檔案。 Build httpd as a Position Independent Executable
--enable-modules=MODULE-LIST 啟用的模組,用空格分別列出,或使用all,most列出所有或常用的模組。 Space-separated list of modules to enable | "all" |
"most"
--enable-mods-shared=MODULE-LIST 啟用的共享DSO模組,用空格分別列出,或使用all,most列出所有或常用的共享DOS模組。(注1) Space-separated list of shared modules to enable |
"all" | "most"
--disable-authn-file 禁用基於檔案的驗證控制 file-based authentication control
--enable-authn-dbm 啟用基於DBM的驗證機制 DBM-based authentication control

--enable-authn-anon

 
啟用匿名的驗證機制 anonymous user authentication control
--enable-authn-dbd 啟用基於SQL的驗證機制 SQL-based authentication control
--disable-authn-default 禁止預設的驗證機制方式backstopper authentication backstopper
--enable-authn-alias 啟用別名驗證 auth provider alias
--disable-authz-host 禁用基於主機的授權機制
host-based authorization control
--disable-authz-groupfile 禁用組授權機制 'require group' authorization control
--disable-authz-user 禁用使用者授權機制 'require user' authorization control
--enable-authz-dbm 基於DBM資料庫的授權機制 DBM-based authorization control
--enable-authz-owner 基於檔案所有者的授權機制 'require file-owner' authorization control
--enable-authnz-ldap 啟用基於LDAP的的授權方式 LDAP based authentication
--disable-authz-default 禁用預設的backstopper授權方式 authorization control backstopper
--disable-auth-basic 禁用基本驗證 basic authentication
--enable-auth-digest 啟用RFC2617摘要式身份驗證 RFC2617 Digest authentication
--enable-isapi 啟用ISAPI擴充套件支援(注2) isapi extension support
--enable-file-cache 啟用檔案快取 File cache
--enable-cache 啟用動態檔案快取 dynamic file caching
--enable-disk-cache
啟用磁碟快取模組
disk caching module
--enable-mem-cache 啟用記憶體快取模組 memory caching module
--enable-dbd 啟用apache的DBD框架 Apache DBD Framework
--enable-bucketeer 水桶操作過濾器 buckets manipulation filter
--enable-dumpio I/O轉儲過濾器 I/O dump filter
--enable-echo 啟用回顯服務 ECHO server
--enable-example 例項和演示模組 example and demo module
--enable-case-filter 啟用大寫轉換過濾器 example uppercase conversion filter
--enable-case-filter-in 啟用大寫轉換輸入過濾器 example uppercase conversion input filter
--enable-ext-filter 擴充套件過濾模組 external filter module
--disable-include 禁用伺服器端嵌入(SSI) Server Side Includes
--disable-filter 禁用智慧過濾 Smart Filtering
--enable-substitute 答覆的內容重寫式過濾 response content rewrite-like filtering
--disable-charset-lite 禁用字符集轉換 character set translation
--enable-charset-lite 啟用字符集轉換 character set translation
--enable-deflate 壓縮轉換編碼支援 Deflate transfer encoding support
--enable-ldap 啟用LDAP的快取記憶體和連線池服務 LDAP caching and connection pooling services
--disable-log-config 禁用日誌配置 logging configuration
--enable-log-forensic 啟用forensic日誌記錄 forensic logging
--enable-logio 輸入和輸出記錄 input and output logging
--disable-env 禁用環境變數,清除設定環境變數 clearing/setting of ENV vars
--enable-mime-magic 自動確定MIME型別 automagically determining MIME type
--enable-cern-meta 啟用CERN型別元檔案 CERN-type meta files
--enable-expires 頭部有效期控制 Expires header control
--enable-headers HTTP頭控制HTTP header control
--enable-ident RFC 1413身份檢查 RFC 1413 identity check
--enable-usertrack 使用者session跟蹤 user-session tracking
--enable-unique-id 啟用每個請求唯一的ID per-request unique ids
--disable-setenvif 基於頭部的環境變數 basing ENV vars on headers
--disable-version 通過配置檔案中決定http版本 determining httpd version in config files
--enable-proxy apache 代理模組 Apache proxy module
--enable-proxy-connect apache 代理連線模組 Apache proxy CONNECT module
--enable-proxy-ftp apache代理ftp模組 Apache proxy FTP module
--enable-proxy-http apache代理http模組 Apache proxy HTTP module
--enable-proxy-ajp apache代理ajp模組 Apache proxy AJP module
--enable-proxy-balancer apache代理balancer模組 Apache proxy BALANCER module
--enable-ssl 啟用ssl支援 SSL/TLS support (mod_ssl)
--enable-distcache 在mod_ssl模組中啟用Distcache。磁碟快取(Distcache)用於分散式的會話快取。主要用在 SSL/TLS 伺服器。它可以被 Apache 使用。大多數的桌上型電腦應該關閉它。 Select distcache support in mod_ssl
--enable-optional-hook-export 啟用可選鉤子輸出者示例 example optional hook exporter
--enable-optional-hook-import 啟用可選鉤子輸入者示例 example optional hook importer
--enable-optional-fn-import 啟用可選函式輸入者示例 example optional function importer
--enable-optional-fn-export 啟用可選函式輸出者示例 example optional function exporter
--enable-static-support 為所支援的二進位制檔案建立一個靜態連結的版本 Build a statically linked version of the support binaries
--enable-static-htpasswd 建立靜態版本的htpasswd Build a statically linked version of htpasswd
--enable-static-htdigest 建立htdigest的靜態版本 Build a statically linked version of htdigest
--enable-static-rotatelogs 建立rotatelogs的靜態版本 Build a statically linked version of rotatelogs
--enable-static-logresolve 建立logresolve的靜態版本 Build a statically linked version of logresolve
--enable-static-htdbm 建立htdbm的靜態版本 Build a statically linked version of htdbm
--enable-static-ab 建立ab的靜態版本 Build a statically linked version of ab
--enable-static-checkgid 建立checkgid的靜態版本 Build a statically linked version of checkgid
--enable-static-htcacheclean 建立htcacheclean的靜態版本 Build a statically linked version of htcacheclean
--enable-static-httxt2dbm 建立httxt2dbm的靜態版本 Build a statically linked version of httxt2dbm
--enable-http 啟用http協議處理 HTTP protocol handling
--disable-mime 禁用對映副檔名到mime型別 mapping of file-extension to MIME
--enable-dav 啟用webdav協議處理 WebDAV protocol handling
--disable-status 禁用程序或執行緒的監控 process/thread monitoring
--disable-autoindex 禁用目錄列表 directory listing
--disable-asis 禁用as-is檔案型別 as-is filetypes
--enable-info 啟用伺服器資訊 server information
--enable-suexec 啟用suexec,為產生的程序設定uid和gid set uid and gid for spawned processes
--disable-cgid 禁用CGID CGI scripts
--enable-cgi 啟用CGI CGI scripts
--disable-cgi 禁用CGI CGI scripts
--enable-cgid 啟用CGID CGI scripts
--enable-dav-fs 啟用DAV檔案系統提供者 DAV provider for the filesystem
--enable-dav-lock 啟用DAV提供者的一般鎖定 DAV provider for generic locking
--enable-vhost-alias 啟用大規模的虛擬主機模組 mass virtual hosting module
--disable-negotiation 禁用內容協商 content negotiation
--disable-dir 禁用目錄請求處理 directory request handling
--enable-imagemap
啟用伺服器端圖片對映圖
server-side imagemaps
--disable-actions 禁用請求上的行為觸發器 Action triggering on requests
--enable-speling 啟用常見的URL拼寫錯誤糾正 correct common URL misspellings
--disable-userdir
禁用特定使用者目錄的請求的對映
mapping of requests to user-specific directories
--disable-alias 禁用不同檔案系統部分的請求的對映 mapping of requests to different filesystem parts
--enable-rewrite 基本的URL操縱規則,即啟用URL重寫規則 rule based URL manipulation
--enable-so 啟用DSO效能 DSO capability

注:

1、模組列表:

基本(B)模組預設包含,必須明確禁用;擴充套件(E)/實驗(X)模組預設不包含,必須明確啟用

2、Apache HTTP伺服器是一個模組化的軟體,管理員可以通過選擇伺服器中包含的模組進行功能增減。模組可以在編譯時被靜態包含進httpd二進位制檔案,也可以編譯成獨立於httpd二進位制檔案的動態共享物件(DSO)。DSO模組可以與伺服器一起編譯,也可以用Apache擴充套件工具(apxs)單獨編譯。

3、ISAPI 伺服器擴充套件是可以被 HTTP 伺服器載入和呼叫的 DLL。Internet 伺服器擴充套件也稱為 Internet 伺服器應用程式 (ISA),用於增強符合 Internet 伺服器 API (ISAPI) 的伺服器的功能。ISA 通過瀏覽器應用程式呼叫,並且將相似的功能提供給通用閘道器介面 (CGI) 應用程式。

可選包選項:

--with-PACKAGE[=ARG] 包含包的語法 use PACKAGE [ARG=yes]
--without-PACKAGE 不使用該包語法 do not use PACKAGE (same as --with-PACKAGE=no)
--with-included-apr 捆綁拷貝apr/apr-util資訊 Use bundled copies of APR/APR-Util
--with-apr=PATH apr的安裝目錄 prefix for installed APR or the full path to
--with-apr-util=PATH apu的安裝目錄 prefix for installed APU or the full path to apu-config
--with-pcre=PATH 使用擴充套件的PCRE正則表示式庫 Use external PCRE library
--with-port=PORT 監聽埠 Port on which to listen (default is 80)
--with-sslport=SSLPORT ssl的監聽埠 Port on which to securelisten (default is 443)
--with-z=DIR zlib的庫檔案位置 use a specific zlib library
--with-sslc=DIR RSA SSL-C SSL/TLS軟體包目錄 RSA SSL-C SSL/TLS toolkit
--with-ssl=DIR openssl包的位置。 OpenSSL SSL/TLS toolkit
--with-mpm=MPM 選擇apache所使用的處理模組。(注1) Choose the process model for Apache to use.
MPM={beos|event|worker|prefork|mpmt_os2}
--with-module=module-type:module-file 新增第三方模組。(注2) Enable module-file in the modules/<module-type>directory.
--with-program-name 指定可執行程式的名字[預設為:httpd],若使用此選項則預設配置檔案的名字將同時變成"NAME.conf"。 alternate executable name
--with-suexec-bin suexec二進位制檔案目錄[預設--sbindir] Path to suexec binary
--with-suexec-calle 允許呼叫suexec的使用者,改使用者必須和執行httpd子程序的使用者相同 User allowed to call SuExec
--with-suexec-userdir 使用者主目錄下允許suexec對其中的檔案具有執行許可權的子目錄,僅在將suexec和使用者網站目錄(由mod_userdir提供支援)一起使用的情況下才需要設定此選項[public_html] User subdirectory
--with-suexec-docroot 允許suexec對其中的檔案具有執行許可權的根目錄[--datadir/htdocs] SuExec root directory
--with-suexec-uidmin 允許執行suexec的最小UID[100] Minimal allowed UID
--with-suexec-gidmin 允許執行suexec的最小GID[100] Minimal allowed GID

--with-suexec-logfile
suexec日誌檔名[預設檔名為:suexec_log ,位於--logfiledir目錄下] Set the logfile
--with-suexec-safepath 對suexec"安全"的PATH環境變數的值[/usr/local/bin:/usr/bin:/bin] Set the safepath
--with-suexec-umask suexec程序的umask[取決於系統的設定] umask for suexec'd process

注:1、MPM是你想要使用的多路處理模組的名字。如果你不使用這個選項,那麼將會使用對應於各平臺的預設MPM。

2、module-file是模組的原始碼檔名,該檔案必須位於Apahe原始碼目錄樹的"modules/module-type"目錄下,如果configure沒有在那裡找到module-file ,則將它看作一個絕對路徑名並嘗試將其複製到"modules/module-type"目錄中,如果"modules/module-type"目錄不存在,configure將新建一個"modules/module-type"目錄並在其中放置一個標準的Makefile.in檔案。這種方法有兩個明顯的缺陷:模組的原始碼必須是單一檔案;模組只能靜態連線進核心,而不能作為DSO模組。所以一般並不使用此方法,而是使用apxs(Apache擴充套件工具)來新增第三方模組支援。

編譯器選項:

CC 指定的C編譯器 C compiler command
CFLAGS C編譯器的FLAGS C compiler flags
LDFLAGS 聯結器flags,比如使用"-L-Llibdir"指定一個非標準的庫檔案目錄libdir linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>
LIBS 設定執行緒模型 libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++預處理程式flags,比如使用"-Iincludedir"指定一個非標準的標頭檔案目錄includedir C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C預處理程式 C preprocessor

4、編譯安裝

./configure --prefix=/usr/local/apache --enable-authn-dbm --enable-authz-dbm --enable-ssl --enable-vhost-alias --enable-rewrite --enable-so --enable-charset-lite --enable-deflate --with-z --with-ssl --with-mpm=prefork

make

make install