?? ahttp.txt
字號:
APACHE
An HTTP Server
Reference Manual
@ David Robinson and the Apache Group, 1995
http://www.apache.org/
保留所有權利。這個產(chǎn)品或文件受版權保護并且得在限制其用途,復制
,散播以及編輯的授權下散播。細節(jié)請參閱阿帕契授權書。
版權所有者不對這份手冊的內(nèi)容作任何保證及建議而且特別聲明不保證
符合任何商業(yè)目的。
版權所有者保留修訂這份手冊的權利且其內(nèi)容得依時變更而不必通知任
何人這些修訂與變更。
All rights reserved. This product or documentation protected by
copyright
and is distributed under licences restricting its use,
copying,
distribution and decompilation. See the Apache licence for details.
The copyright owner gives no warranties and makes no representations
about
the contents of this manual and specifically disclaims
warranties of
merchantability of fitness for any purpose.
The Copyright owner reserves the right to revise this manual and
make
changes from time to time in its contents without notifying any
person of
such revision or changes.
TRADEMARKS
Unix is a registered trademark of UNIX System Laboratories, Inc.
Sun and
SunOs are trademarks of Sun Microsystems, Inc. Netscape is a
trademark of
Netscape Communications Corporation. All other product names
mentioned
herein are trademarks of their respective owners.
目錄(Contents) (略)
序(Preface)
這份手冊是 1.0 版阿帕契伺服器(Apache HTTP server)的文件。這個
伺服器是阿帕契計畫的產(chǎn)品,此計畫試圖回應某些對積極發(fā)展一套可以
免費取得之 HTTP 伺服器的關心。這個計畫的目標是提供一個安全的,
有效率的而且可以擴充功能的伺服器,此伺服器提供 HTTP 服務且符合
目前的 HTTP 標準。
這套阿帕契 httpd 伺服器的設計不但與 NCSA httpd 1.3 相容,并且
提供常常有人要求的特色,像是
。作為身分驗認之用的 DBM 資料庫
。自定的(customised)錯誤與問題回應方式
。多重的 directoryindex 指令
。不限次數(shù)的 Alias 以及 Redirect 指令
。以內(nèi)容為基礎的(Content-based) 文件協(xié)商(negotiation)
。虛擬伺服器
阿帕契授權書
Copyright 1995 The Apache Group. All rights reserved.
假若符合下列條件,無論是否經(jīng)過修改,以原始程式及執(zhí)行程式的形式
散播與使用都是許可的:
1. 散播原始程式碼必須保留上述的版權告示,這份條件列表以及下列
聲明。
2. 以執(zhí)行程式碼的形式散播必須在隨附散播的文件以及/或是資訊中
重現(xiàn)上述的版權告示,這份條件列表以及下列聲明。
3. 所有提及或使用這套軟體特色的廣告都必須顯示下列訊息:
`This product includes software developed by the Apache Group
for
use in the Apache HTTP server project
(http://www.apache.org/).'
4. `Apache Server' 以及 `Apache Group' 這些名稱沒有隨附前述的
的許可不得用來為這套軟體的衍生產(chǎn)品背書或鼓勵采用。
5. 以任何形式散播都必須保留下列訊息:
`This product includes software developed by the Apache Group
for
use in the Apache HTTP server project
(http://www.apache.org/).'
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following condictions
are met:
1. Redistribution of source code must retain the above copyright
notice, this list of condictions and the following disclaimer.
2. Redistribution in binary form must reproduce the above copyright
notice, this list of condictions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledge: `This product
includes software developed by the Apache Group for use in the
Apache HTTP server project (http://www.apache.org/).'
4. The names `Apache Server' and `Apache Group' must not be used to
endorse or prompt products derived from this software without
prior written permission.
5. Redistribution of any form whatsoever must retain the following
acknowledge: `This product includes software developed by the
Apache Group for use in the Apache HTTP server project
(http://www.apache.org/).'
THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
EXPRESSED OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARITICULAR PURPOSE ARE
DISCLAIMED. IN NO
EVENT SHALL THE APACHE GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,
INDIRECT, INCIDETAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES
(INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS
OF USE,
DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY
OF LIABILITY, WHERHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING
NEGLIGENCE OR OTHER WISE)ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many
individuals
on behalf of the Apache Group and was originally based on
public domain
software written at the National Center for Supercomputing
Applications,
University of Illinois, Urbana-Champaign. For more information on
the apache
Group and the Apache HTTP server project, please see
http://www.apache.org/.
第一章
編譯以及安裝阿帕契
1.1 下載阿帕契
最新的阿帕契資訊可以在阿帕契網(wǎng)站 http://www.apache.org/ 找到。
此處會列出目前發(fā)行的版本,任何更新的公開測試版,同時還有映射的
(mirror)網(wǎng)站與匿名檔案傳輸(ftp) 站之細節(jié)。
1.2 編譯阿帕契
這一版的阿帕契支援所謂的‘選用性模組’。然而,為了使這些模組能
有效率,此伺服器必須知道哪些模組要編譯進去;這需要產(chǎn)生一點短短
的程式碼(`modules.c') 單純地列出它們。
如果你滿意我們的標準模組集,而且打算繼續(xù)讓它保持這樣,那麼你可
以直接編輯我們提供的 Makefile 并且如同你以前作過的一樣編譯它。
如果你想要使用選用性模組,那麼無論如何,你都得執(zhí)行配置指令稿。
這樣做:
1. 編輯 `Configuration' 這個檔案。這里面包含每一種機器
的 Makefile 設定,而且在這底下還有個額外的節(jié)區(qū)列出要
編譯進去的模組,以及包含這些模組的檔案名稱,你將得:
(a) 選擇適合你機器的一種編譯器以及編譯選項。
(b) 消掉相對於你想包含進去的模組上面的注解(檔案底
端列出模組的那些行)或者加上對應你自己所撰寫之
自制(custom)模組的一些新行。注意,如果你想要有
DBM 驗認(auth)的話必須明確地配置進去;只要消掉
對應的行上面的注解即可。
2. 執(zhí)行 `Configure' 這個指令稿:
% Configure
Using `Configuration' as config file
%
這會產(chǎn)生新版的 Makefile 以及 modules.c 檔案。如果你
想要維護多個配置,那麼你可以這樣,例如
% Configure -file Configuration.ai
Using alternate config file Configuration.ai
%
3. 鍵入 `make'
我們放進阿帕契發(fā)行套件里的模組是我們測試過而且有許多
阿帕契發(fā)展群成員使用的模組。這些成員或協(xié)力團體(third
parties)配合特殊需要或功能而貢獻的一些額外模組可以在
里
找到。在該網(wǎng)頁上有如何連結這些模組到阿帕契核心程式碼
里去的說明。
1.3 安裝阿帕契
編譯之後,你將會在 src/ 目錄里獲得一份稱為 `httpd' 的執(zhí)行碼。
阿帕契的執(zhí)行碼發(fā)行套件會提供這個檔案。
下一個步驟是為伺服器編輯配置檔。你應該會在稱為 `conf' 的目錄里
發(fā)現(xiàn)三個配置檔的發(fā)行版本: srm.conf-dist, access.conf-dist 以及
httpd.conf-dist 。把它們復制成所需的 srm.conf, access.conf 及
httpd.conf 檔案。
首先編輯 httpd.conf 。這設定此伺服器一般的屬性;埠號,執(zhí)行者的
身分等等。接下來編輯 srm.conf 檔案;這設定文件樹的根,指定像是
伺服端剖析的 HTML 或內(nèi)部的影像地圖(imagemap)剖析等等功能。最後
編輯 access.conf 檔案,至少作些存取(access)的基本設定。
最後,呼叫 httpd 程式,使用 -f 參數(shù)配合 httpd.conf 所在的完整
路徑。像是,最普遍的例子:
/usr/local/etc/apache/src/httpd -f
/usr/local/etc/apache/conf/httpd.conf
現(xiàn)在伺服器應該已經(jīng)開始執(zhí)行。
依照預設 srm.conf 以及 access.conf 這些檔案是藉由名稱定位的;
要藉由其它的名稱來指定呼叫它們的話,可以在 httpd.conf 里面使用
AccessConfig 以及 ResourceConfig 指令。
第二章
啟動阿帕契
2.1 啟動阿帕契
httpd 這支程式可以藉由網(wǎng)際網(wǎng)路伺服程式 inetd 在每一次有連線要
進入 HTTP 服務的時候啟動,或者另一種方式,它也可以作為伺服程式
(daemon)持續(xù)地執(zhí)行,處理請求。無論選擇哪一種方式,都必須設定這
個 ServerType 指令告訴伺服器它要如何執(zhí)行。
2.2 命令列選項
下列選項可以用在 httpd 的命令列上:
-d serverroot
把 ServerRoot 這個變數(shù)的起始值設定為 serverroot 。這可以
藉由在配置檔案里面的 ServerRoot 命令來加以改變。此預設為
/usr/local/etc/httpd 。
-f config
啟動時執(zhí)行在 config 檔案里面的指令。如果 config 沒有以 /
作為開始的話,那麼它會被當作相對於 ServerRoot 的路徑。此
預設值是 conf/httpd.conf 。
-X
以單一程序(single-process)模式執(zhí)行,只用在內(nèi)部除錯;伺服
程式不會脫離終端作業(yè)或是產(chǎn)生任何子程序。不要使用這個模式
來提供正常的網(wǎng)頁服務。
-v
列印 httpd 的版本,然後結束。
-?
列印 httpd 選項的一份列表,然後結束。
2.3 配置檔
此伺服器將會讀取三個配置指令檔案。任何指令都可以出現(xiàn)在這些檔案
任何一個里面。這些檔案的名稱是相對於伺服器的根(server root) ;
這是根是藉由 ServerRoot 指令,或是 -d 這個命令列旗標所指定的。
依慣例這些檔案是:
conf/httpd.conf
包含控制伺服程式運作的指令。檔案名稱可以配合 -f 命令列旗
旗標加以改變。
conf/srm.conf
包含控制伺服器提供給客戶端之文件規(guī)格的指令。檔案名稱可以
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -