天天看點

Linux全攻略--Apache伺服器配置與管理(一)

一、Apache的安裝

首先使用下面的指令來檢視系統是否已經安裝了Apache

可看到已經安裝好了。

另外也可以在終端視窗中執行來檢視httpd程式是否在執行。

下面介紹Apache伺服器檔案和目錄

WEB站點目錄                                                                           描述

/var/www                           Apache WEB站點檔案的目錄

/var/www/html                 WEB站點的WEB檔案

/var/www/cgi-bin             CGI程式檔案

/var/www/html/manual   Apache WEB伺服器手冊

/var/www/htmll/usage    webalizer程式檔案

配置檔案

/etc/httpd/conf     基于目錄的配置檔案,.htaccess檔案包含對它所在目錄中檔案的通路控制指令

/etc/httpd/conf/httpd.conf   Apache WEB伺服器配置檔案目錄

/etc/httpd/conf/srm.conf       主要的Apache WEB伺服器配置檔案

/etc/httpd/conf/access.conf   用來處理文檔規範,配置檔案類型昨未知的老式配置檔案

啟動腳本

/etc/rc.d/init.d/httpd        WEB伺服器守護程序的啟動腳本

/etc/rc.d/rc3.d/S85httpd   将運作級目錄(/etc/rc3.d)連接配接到目錄/etc/rc.d/init.d中的啟動腳本

應用檔案

/usr/sbin      Apache WEB伺服器程式檔案和應用程式的位置

/usr/doc/   Apache WEB伺服器文檔

/var/log/http  Apache 日志檔案的位置

二、啟動和運作Apache伺服器

其中一種是:

另處一種是:

httpd除了start\stop指令之外,還有reload,condrestant,status指令,共6種狀态

三.啟動系統時自動運作Apache

若想讓系統自動執行Apache,隻需執行setup指令,進行Text Mode Setup Utility界面,選中System services中的:httpd服務"即可.

當然,還有一種更友善的圖形化方法.選擇"應用程式/系統設定/伺服器設定/服務/

四.httpd.conf檔案詳細和配置

舊版中的srm.conf與access.conf檔案的内容都被整合到httpd.conf檔案中了.

#

# Based upon the NCSA server configuration files originally by Rob McCool.

# This is the main Apache server configuration file.  It contains the

# configuration directives that give the server its instructions.

# the directives.

#這是Apache伺服器主要配置檔案。

#它包含伺服器的影響伺服器運作的配置指令。

#參見以取得關于這些指令的詳細資訊

# Do NOT simply read the instructions in here without understanding

# what they do.  They're here only as hints or reminders.  If you are unsure

# consult the online docs. You have been warned.  

#不要隻是簡單的閱讀這些指令資訊而不去了解它。

#這裡隻是做了簡單的說明,如果你沒有參考線上檔案,你就會被警告。

# The configuration directives are grouped into three basic sections:

#  1. Directives that control the operation of the Apache server process as a

#     whole (the 'global environment').

#  2. Directives that define the parameters of the 'main' or 'default' server,

#     which responds to requests that aren't handled by a virtual host.

#     These directives also provide default values for the settings

#     of all virtual hosts.

#  3. Settings for virtual hosts, which allow Web requests to be sent to

#     different IP addresses or hostnames and have them handled by the

#     same Apache server process.

#這些配置指令被分為下面三個部分:

#1. 控制整個Apache伺服器行為的部分(即全局環境變量)

#2. 定義主要或者預設服務參數的指令,也為所有虛拟主機提供預設的設定參數

#3. 虛拟主機的設定參數

# Configuration and logfile names: If the filenames you specify for many

# of the server's control files begin with "/" (or "drive:/" for Win32), the

# server will use that explicit path.  If the filenames do *not* begin

# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"

# with ServerRoot set to "/etc/httpd" will be interpreted by the

# server as "/etc/httpd/logs/foo.log".

#配置和日志檔案名:如果你指定的檔案名以“/”開始(win32下以“dirver:/”),

#伺服器将使用絕對路徑,如果檔案名不是以“/”開始的,那麼它将把ServerRoot

#的值附加在檔案名的前面,例如,對“logs/foo.log",如果ServerRoot的值

#為“/etc/httpd”,則該檔案應為“/etc/httpd/logs/foo.log”

### Section 1: Global Environment

# The directives in this section affect the overall operation of Apache,

# such as the number of concurrent requests it can handle or where it

# can find its configuration files.

##第一區:全局環境參數

#這裡設定的參數将影響整個Apache伺服器的行為;

#例如Apache能夠處理的并發請求的數量等。

# ServerRoot: The top of the directory tree under which the server's

# configuration, error, and log files are kept.

#ServerRoot:指出伺服器儲存其配置、出錯和日志檔案等的根目錄。

# NOTE!  If you intend to place this on an NFS (or otherwise network)

# mounted filesystem then please read the LockFile documentation

# you will save yourself a lot of trouble.

# Do NOT add a slash at the end of the directory path.

ServerRoot "/etc/httpd"

#注意!如果你想要将它指定為NFS或其它網絡上的位置,

#請一定要去閱讀與LockFile有關的文檔(可能在

#)。

#這将會使你自己也能解決很多問題。

#路徑的結尾不要添加斜線。

# PidFile: The file in which the server should record its process

# identification number when it starts.

PidFile run/httpd.pid

#串行通路的鎖檔案必須儲存在本地磁盤上

#PidFile:記錄伺服器啟動程序号的檔案。

# Timeout: The number of seconds before receives and sends time out.

Timeout 120

#Timeout:接收和發送前逾時秒數

# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.

KeepAlive Off

#KeepAlive:是否允許穩固的連接配接(每個連接配接有多個請求),

#設為"Off"則停用。

# MaxKeepAliveRequests: The maximum number of requests to allow

# during a persistent connection. Set to 0 to allow an unlimited amount.

# We recommend you leave this number high, for maximum performance.

MaxKeepAliveRequests 100

#MaxKeepAliveRequests:在穩固連接配接期間允許的最大請求數,

#設為0表示無限制接入。

#我們推薦你将其設為一個較大的值,以便提高性能

# KeepAliveTimeout: Number of seconds to wait for the next request from the

# same client on the same connection.

KeepAliveTimeout 15

#KeepAliveTimeout:在同一個連接配接上從同一台客戶上接收請求的秒數

##

## Server-Pool Size Regulation (MPM specific)

##Server-Pool大小設定(針對MPM的)

# prefork MPM

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# ServerLimit: maximum value for MaxClients for the lifetime of the server

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule prefork.c>

StartServers       8

MinSpareServers    5

MaxSpareServers   20

ServerLimit      256

MaxClients       256

MaxRequestsPerChild  4000

</IfModule>

# StartServers:啟動時伺服器啟動的程序數

# MinSpareServers:保有的備用程序的最小數目

# MaxSpareServers:保有的備用程序的最大數目

# MaxClients:伺服器允許啟動的最大程序數

# MaxRequestsPerChild:一個服務程序允許的最大請求數

StartServers 8

MinSpareServers 5

MaxSpareServers 20

MaxClients 256

MaxRequestPerChild 4000

# worker MPM

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadsPerChild: constant number of worker threads in each server process

<IfModule worker.c>

StartServers         2

MaxClients         150

MinSpareThreads     25

MaxSpareThreads     75 

ThreadsPerChild     25

MaxRequestsPerChild  0

# StartServers:伺服器啟動時的服務程序數目

# MaxClients:允許同時連接配接的最大使用者數目

# MinSpareThreads:保有的最小工作線程數目

# MaxSpareThreads:允許保有的最大工作線程數目

# ThreadsPerChild:每個服務程序中的工作線程常數

# MaxRequestsPerChild:服務程序中允許的最大請求數目

StartServers 2

MaxClients 150

MinSpareThreads 25

MaxSpareThreads 75

ThreadsPerChild 25

MaxRequestsPerChild 0

# Listen: Allows you to bind Apache to specific IP addresses and/or

# ports, in addition to the default. See also the <VirtualHost>

# directive.

# Change this to Listen on specific IP addresses as shown below to 

# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)

#Listen 12.34.56.78:80

Listen 80

# Listen:允許你綁定Apache服務到指定的IP位址和端口上,以取代預設值

# 參見指令

# 使用如下指令使Apache隻在指定的IP位址上監聽,

# 以防止它在IP位址0.0.0.0上監聽

# Listen 12.34.56.78:80

# Dynamic Shared Object (DSO) Support

# To be able to use the functionality of a module which was built as a DSO you

# have to place corresponding `LoadModule' lines at this location so the

# directives contained in it are actually available _before_ they are used.

# Statically compiled modules (those listed by `httpd -l') do not need

# to be loaded here.

# Example:

# LoadModule foo_module modules/mod_foo.so

# 動态共享支援(DSO)

# 為了能夠使用那些以DSO模式編譯的子產品中的函數,你必須有相應的“LoadModule”行,

# 是以,在這裡包含了這些指令,以便能在使用它之前激活。

# 那些靜态編譯的子產品不需要在這裡列出 (即以“httpd -l”列出的子產品)

# 示例:

LoadModule access_module modules/mod_access.so

LoadModule auth_module modules/mod_auth.so

LoadModule auth_anon_module modules/mod_auth_anon.so

LoadModule auth_dbm_module modules/mod_auth_dbm.so

LoadModule auth_digest_module modules/mod_auth_digest.so

LoadModule ldap_module modules/mod_ldap.so

LoadModule auth_ldap_module modules/mod_auth_ldap.so

LoadModule include_module modules/mod_include.so

LoadModule log_config_module modules/mod_log_config.so

LoadModule env_module modules/mod_env.so

LoadModule mime_magic_module modules/mod_mime_magic.so

LoadModule cern_meta_module modules/mod_cern_meta.so

LoadModule expires_module modules/mod_expires.so

LoadModule deflate_module modules/mod_deflate.so

LoadModule headers_module modules/mod_headers.so

LoadModule usertrack_module modules/mod_usertrack.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule mime_module modules/mod_mime.so

LoadModule dav_module modules/mod_dav.so

LoadModule status_module modules/mod_status.so

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule asis_module modules/mod_asis.so

LoadModule info_module modules/mod_info.so

LoadModule dav_fs_module modules/mod_dav_fs.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 imap_module modules/mod_imap.so

LoadModule actions_module modules/mod_actions.so

LoadModule speling_module modules/mod_speling.so

LoadModule userdir_module modules/mod_userdir.so

LoadModule alias_module modules/mod_alias.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule proxy_connect_module modules/mod_proxy_connect.so

LoadModule cache_module modules/mod_cache.so

LoadModule suexec_module modules/mod_suexec.so

LoadModule disk_cache_module modules/mod_disk_cache.so

LoadModule file_cache_module modules/mod_file_cache.so

LoadModule mem_cache_module modules/mod_mem_cache.so

LoadModule cgi_module modules/mod_cgi.so

# Load config files from the config directory "/etc/httpd/conf.d".

Include conf.d/*.conf

# ExtendedStatus controls whether Apache will generate "full" status

# information (ExtendedStatus On) or just basic information (ExtendedStatus

# Off) when the "server-status" handler is called. The default is Off.

#ExtendedStatus On

# ExtendedStatus:當調用“server-status”時,控制Apache是産生“全”狀态

# 資訊(ExtendedStatus On),還是産生基本資訊(ExtendedStatus Off)。

# 預設為off

# ExtendedStatus On

### Section 2: 'Main' server configuration

# The directives in this section set up the values used by the 'main'

# server, which responds to any requests that aren't handled by a

# <VirtualHost> definition.  These values also provide defaults for

# any <VirtualHost> containers you may define later in the file.

# All of these directives may appear inside <VirtualHost> containers,

# in which case these default settings will be overridden for the

# virtual host being defined.

### 第二區:“主”服務配置

# 這一區建立被 “主” 伺服器用的指令值,以回應那些不被 

# 定義處理的任何請求。

# 這些數值也提供預設值給後面定義的容器。

# 如果中有定義,那麼這裡定義的指令值将被

# 中的定義所覆寫。

# If you wish httpd to run as a different user or group, you must run

# httpd as root initially and it will switch.  

# User/Group: The name (or #number) of the user/group to run httpd as.

#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".

#  . On HPUX you may not be able to use shared memory as nobody, and the

#    suggested workaround is to create a user www and use that user.

#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)

#  when the value of (unsigned)Group is above 60000; 

#  don't use Group #-1 on these systems!

User apache

Group apache

# 如果你想使httpd以另外的使用者或組來運作,你必須在開始時以root方式啟動

# 然後再将它切換為你想要使用的使用者或組。

# User/Group:運作httpd的使用者群組

# 在SCO (ODT3)上使用“User nouser”和“Group nogroup”

# 在HPUX上,你可能不能以nobody身份使用共享記憶體,建議建立一個www使用者。

# 注意一些核心(kernel)在組ID大于60000時拒絕setgid(Group)或semctl(IPC_SET),

# 建議在這些系統上不要使用“Group #-1”。

# ServerAdmin: Your address, where problems with the server should be

# e-mailed.  This address appears on some server-generated pages, such

# ServerAdmin:你的郵件位址,當發生問題時Apache将向你發出郵件。

# 作為一個出錯文檔,這個位址顯示在server-generated頁上,

# ServerName gives the name and port that the server uses to identify itself.

# This can often be determined automatically, but we recommend you specify

# it explicitly to prevent problems during startup.

# If this is not set to valid DNS name for your host, server-generated

# redirections will not work.  See also the UseCanonicalName directive.

# If your host doesn't have a registered DNS name, enter its IP address here.

# You will have to access it by its address anyway, and this will make 

# redirections work in a sensible way.

#ServerName new.host.name:80

# ServerName指定Apache用于識别自身的名字和端口号。

# 通常這個值是自動指定的,但是我們推薦你顯式的指定它以防止啟動時出錯

# 如果你為你的主機指定了一個無效的DNS名,server-generated重定向将不能工作。

# 參見UseCanonicalName指令

# 如果你的主機沒有注冊DNS名,在這裡鍵入它的IP位址

# 無論如何,你必須使用它的IP位址來提供服務,

# 這裡使用一種容易了解的方式重定向服務

ServerName new.host.name:80

# UseCanonicalName: Determines how Apache constructs self-referencing 

# URLs and the SERVER_NAME and SERVER_PORT variables.

# When set "Off", Apache will use the Hostname and Port supplied

# by the client.  When set "On", Apache will use the value of the

# ServerName directive.

UseCanonicalName Off

# UseCanonicalName:決定Apache如何構造URLS和 SERVER_NAME 和 SERVER_PORT 的指令。

# 當設定為 “Off”時,Apache會使用使用者端提供的主機名和端口号。

# 當設定為“On”,Apache會使用ServerName指令的值。

# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locations.

DocumentRoot "/var/www/html"

# DocumentRoot:你的文檔的根目錄。預設情況下,所有的請求從這個目錄進行應答。

# 但是可以使用符号連結和别名來指向到其他的位置。

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

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

# directory (and its subdirectories). 

# First, we configure the "default" to be a very restrictive set of 

# features.  

<Directory />

    Options FollowSymLinks

    AllowOverride None

</Directory>

# Apache可以存取的每個目錄都可以配置存取權限(包括它的子目錄)。

# 首先,我們配置一個高限制的特征。

# 這将禁止通路檔案系統所在的目錄,并添加你希望允許通路的目錄塊。

# 如下所示

Order Deny,Allow

Deny from all

# Note that from this point forward you must specifically allow

# particular features to be enabled - so if something's not working as

# you might expect, make sure that you have specifically enabled it

# below.

# 注意從這裡開始你一定要明确地允許哪些特别的特征能夠被使用。

# - 是以,如果Apache沒有象你所期待的那樣工作的話,

# 請檢查你是否在下面明确的指定它可用。

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

# 這将改變到你設定的DocumentRoot

<Directory "/var/www/html">

# Possible values for the Options directive are "None", "All",

# or any combination of:

#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

# Note that "MultiViews" must be named *explicitly* --- "Options All"

# doesn't give it to you.

# The Options directive is both complicated and important.  Please see

# for more information.

    Options Indexes FollowSymLinks

# Options:這個指令的值可以是“None”,“All”,或者下列選項的任意組合:

# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

# 注意,“MultiViews”必須被顯式的指定,“Options All”不能為你提供這個特性。

# 這個指令既複雜又重要,請參見

#“[url]http://httpd.apache.org/docs-2.0/mod/core.html#optioins[/url]”以取得更多的資訊。

Options Indexes FollowSymLinks

# AllowOverride controls what directives may be placed in .htaccess files.

# It can be "All", "None", or any combination of the keywords:

#   Options FileInfo AuthConfig Limit

# AllowOverride控制那些被放置在.htaccess檔案中的指令。

# 它可以是“All”,“None”,或者下列指令的組合:

# Options FileInfo AuthConfig Limit

AllowOverride None

# Controls who can get stuff from this server.

    Order allow,deny

    Allow from all

# 控制誰可以獲得服務。

Order allow,deny

Allow from all

# UserDir: The name of the directory that is appended onto a user's home

# directory if a ~user request is received.

# UserDir:指定在得到一個~user請求時将會添加到使用者home目錄後的目錄名。

# The path to the end user account 'public_html' directory must be

# accessible to the webserver userid.  This usually means that ~userid

# must have permissions of 711, ~userid/public_html must have permissions

# of 755, and documents contained therein must be world-readable.

# Otherwise, the client will only receive a "403 Forbidden" message.

<IfModule mod_userdir.c>

    #

    # UserDir is disabled by default since it can confirm the presence

    # of a username on the system (depending on home directory

    # permissions).

    UserDir disable

    # To enable requests to /~user/ to serve the user's public_html

    # directory, remove the "UserDir disable" line above, and uncomment

    # the following line instead:

    # 

    #UserDir public_html

# Control access to UserDir directories.  The following is an example

# for a site where these directories are restricted to read-only.

#<Directory /home/*/public_html>

#    AllowOverride FileInfo AuthConfig Limit

#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

#    <Limit GET POST OPTIONS>

#        Order allow,deny

#        Allow from all

#    </Limit>

#    <LimitExcept GET POST OPTIONS>

#        Order deny,allow

#        Deny from all

#    </LimitExcept>

#</Directory>

# DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.

# The index.html.var file (a type-map) is used to deliver content-

# negotiated documents.  The MultiViews Option can be used for the 

# same purpose, but it is much slower.

DirectoryIndex index.html index.html.var

# DirectoryIndex:定義請求是一個目錄時,Apache向使用者提供服務的檔案名

# index.html.var檔案(一個類型映象檔案)用于提供一個文檔處理清單,

# 出于同樣的目的,也可以使用MultiViews選項,但是它會非常慢。

DirectoryIndex  index.html index.html.var

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

# for additional configuration directives.  See also the AllowOverride

AccessFileName .htaccess

# AccessFileName:在每個目錄中查詢為目錄提供附加配置指令的檔案的檔案名。

# 參見AllowOverride指令。

# The following lines prevent .htaccess and .htpasswd files from being 

# viewed by Web clients. 

<Files ~ "^\.ht">

    Deny from all

</Files>

# 下面的行防止.htaccess和.htpasswd檔案被Web客戶檢視。

# TypesConfig describes where the mime.types file (or equivalent) is

# to be found.

TypesConfig /etc/mime.types

# Typeconfig:定義在哪裡查詢mime.types檔案。

TypeConfig conf/mime.types

# DefaultType is the default MIME type the server will use for a document

# if it cannot otherwise determine one, such as from filename extensions.

# If your server contains mostly text or HTML documents, "text/plain" is

# a good value.  If most of your content is binary, such as applications

# or images, you may want to use "application/octet-stream" instead to

# keep browsers from trying to display binary files as though they are

# text.

DefaultType text/plain

# DefaultType:定義當不能确定MIME類型時伺服器提供的預設MIME類型。

# 如果你的服務主要包含text或HTML文檔,“text/plain”是一個好的選擇;

# 如果大多是二進制文檔,諸如軟體或圖像,你應使用

# “application/octer-stream”來防止浏覽器象顯示文本那樣顯示二進制檔案。

# The mod_mime_magic module allows the server to use various hints from the

# contents of the file itself to determine its type.  The MIMEMagicFile

# directive tells the module where the hint definitions are located.

<IfModule mod_mime_magic.c>

#   MIMEMagicFile /usr/share/magic.mime

    MIMEMagicFile conf/magic

# mod_mime_magic允許伺服器從自己定義自己類型的檔案中使用不同的線索(hints),

# 這個MIMEMagicFile指令定義hints定義所在的檔案。

MIMEMagicFile conf/magic

# HostnameLookups: Log the names of clients or just their IP addresses

# The default is off because it'd be overall better for the net if people

# had to knowingly turn this feature on, since enabling it means that

# each client request will result in AT LEAST one lookup request to the

# nameserver.

HostnameLookups Off

# HostnameLookups:指定記錄使用者端的名字還是IP位址,例如,本指令為on時

# 預設值為off,這要比設為on好得多,因為如果設為on則每個使用者端請求都将會

# 至少造成對 nameserver 進行一次查詢。

# EnableMMAP: Control whether memory-mapping is used to deliver

# files (assuming that the underlying OS supports it).

# The default is on; turn this off if you serve from NFS-mounted 

# filesystems.  On some systems, turning it off (regardless of

# filesystem) can improve performance; for details, please see

#EnableMMAP off

# EnableMMAP:控制是否進行記憶體轉儲(如果作業系統支援的話)。

# 預設為on,如果你的伺服器安裝在網絡檔案系統上(NFS),請關閉它。

# 在一些系統上,關閉它會提升系統性能(與檔案系統類型無關);

# EnableMMAP off

# EnableSendfile: Control whether the sendfile kernel support is 

# used to deliver files (assuming that the OS supports it). 

# filesystems.  Please see

#EnableSendfile off

# EnableSendfile:控制是否使用sendfile kernel支援發送檔案

# (如果作業系統支援的話)。預設為on,如果你的伺服器安裝在網絡檔案系統

# (NFS)上,請你關閉它。

# EnableSendfile off

# ErrorLog: The location of the error log file.

# If you do not specify an ErrorLog directive within a <VirtualHost>

# container, error messages relating to that virtual host will be

# logged here.  If you *do* define an error logfile for a <VirtualHost>

# container, that host's errors will be logged there and not here.

ErrorLog logs/error_log

# ErrorLog:錯誤日志檔案定位。

# 如果你沒有在内定義ErrorLog指令,這個虛拟主機的錯誤資訊

# 将記錄在這裡。如果你在那兒定義了ErrorLog,這些錯誤資訊将記錄在你所

# 定義的檔案裡,而不是這兒定義的檔案。

# LogLevel: Control the number of messages logged to the error_log.

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

LogLevel warn

# LogLevel:控制記錄在錯誤日志檔案中的日志資訊數量。

# 可能的值包括:debug,info,notice,warn,error,crit,alert,emerg。

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

# 下面的指令為CustomLog指令定義格式别名。

LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined

LogFormat "%h %l %u %t "%r" %>s %b" common

# The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a <VirtualHost>

# container, they will be logged here.  Contrariwise, if you *do*

# define per-<VirtualHost> access logfiles, transactions will be

# logged therein and *not* in this file.

#CustomLog logs/access_log common

# 指定接入日志檔案的定位和格式(一般日志格式)。

# 如果你沒有在内定義這個指令,傳輸資訊将記錄在這裡,

# 如果你定義了這個指令,則記錄在你指定的位置,而不是這兒定義的位置。

CustomLog logs/access_log common

# If you would like to have agent and referer logfiles, uncomment the

# following directives.

#CustomLog logs/referer_log referer

#CustomLog logs/agent_log agent

# 如果你想要記錄agent和referer資訊,可以使用下面的指令

# CustomLog logs/referer_log referer

# CustomLog logs/agent_log agent

# For a single logfile with access, agent, and referer information

# (Combined Logfile Format), use the following directive:

CustomLog logs/access_log combined

# 如果你想要使用一個檔案記錄access,agent和referer資訊,

# 你可以如下定義這個指令:

# CustomLog logs/access_log combined

# Optionally add a line containing the server version and virtual host

# name to server-generated pages (internal error documents, FTP directory

# listings, mod_status and mod_info output etc., but not CGI generated

# documents or custom error documents).

# Set to "EMail" to also include a mailto: link to the ServerAdmin.

# Set to one of:  On | Off | EMail

ServerSignature On

# 随意的添加包含伺服器版本和虛拟主機名字一行資訊到server-generated輸出頁中

# (内部錯誤文檔,FTP目錄清單,mod_status和mod_info輸出等等,除了CGI錯誤

# 或自定義的錯誤文檔以外)。

# 設為“EMail”将包含一個指向ServerAdmin的mailto:連接配接。

# 可以為如下值:On | Off | EMail

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

# Alias fakename realname

# Aliases:在這時添加你需要的别名,格式如下:

# Alias 别名 真實名

# Note that if you include a trailing / on fakename then the server will

# require it to be present in the URL.  So "/icons" isn't aliased in this

# example, only "/icons/".  If the fakename is slash-terminated, then the 

# realname must also be slash terminated, and if the fakename omits the 

# trailing slash, the realname must also omit it.

# 注意,如果你在别名的未尾包含了“/”,那麼在URL中也需要包含“/”。

# 是以,“/icons”不是這個示例中的别名。

# 如果别名中以“/”結尾,那麼真實名也必須以“/”結尾,

# 如果别名中省略了結尾的“/”,那麼真實名也必須省略。

# We include the /icons/ alias for FancyIndexed directory listings.  If you

# do not use FancyIndexing, you may comment this out.

Alias /icons/ "/var/www/icons/"

<Directory "/var/www/icons">

    Options Indexes MultiViews

# 我們使用别名“/icons/”來表示FancyIndexed目錄清單,如果你不使用、

# FancyIndexing,你可以注釋掉它。

# Alias /icons/ "/usr/local/apache2/icons/"

# Options Indexes MultiViews

# AllowOverride None

# Order allow,deny

## Allow from all

# WebDAV module configuration section.

<IfModule mod_dav_fs.c>

    # Location of the WebDAV lock database.

    DAVLockDB /var/lib/dav/lockdb

# ScriptAlias: This controls which directories contain server scripts.

# ScriptAliases are essentially the same as Aliases, except that

# documents in the realname directory are treated as applications and

# run by the server when requested rather than as documents sent to the client.

# The same rules about trailing "/" apply to ScriptAlias directives as to

# Alias.

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

# ScriptAlias:指定包含服務腳本的目錄。

# ScriptAliases 本質上與Aliases一樣,除了這裡的文檔在請求時做為程式處理處理以外。

# 尾部的“/”規則與Alias一樣

ScriptAlias /cgi-bin/ "/usr/loacl/apache2/cgi-bin/"

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

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

# clients where to look for the relocated document.

# Redirect允許你告訴用戶端使用存在于伺服器名字空間中的文檔,

# 而不是現在的,這幫助客戶定位那些改變了位置的文檔。

# 例如:

# Directives controlling the display of server-generated directory listings.

# IndexOptions: Controls the appearance of server-generated directory

# listings.

IndexOptions FancyIndexing VersionSort NameWidth=*

# 控制server-generated目錄清單顯示的指令

# IndexOptions:控制server-generated目錄清單顯示特征。

# AddIcon* directives tell the server which icon to show for different

# files or filename extensions.  These are only displayed for

# FancyIndexed directories.

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*

AddIconByType (IMG,/icons/image2.gif) image/*

AddIconByType (SND,/icons/sound2.gif) audio/*

AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe

AddIcon /icons/binhex.gif .hqx

AddIcon /icons/tar.gif .tar

AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv

AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip

AddIcon /icons/a.gif .ps .ai .eps

AddIcon /icons/layout.gif .html .shtml .htm .pdf

AddIcon /icons/text.gif .txt

AddIcon /icons/c.gif .c

AddIcon /icons/p.gif .pl .py

AddIcon /icons/f.gif .for

AddIcon /icons/dvi.gif .dvi

AddIcon /icons/uuencoded.gif .uu

AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl

AddIcon /icons/tex.gif .tex

AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..

AddIcon /icons/hand.right.gif README

AddIcon /icons/folder.gif ^^DIRECTORY^^

AddIcon /icons/blank.gif ^^BLANKICON^^

# AddIcon* 指令告訴伺服器不同擴充名的圖象檔案如何顯示,

# 隻适用于FancyIndexed指令

# DefaultIcon is which icon to show for files which do not have an icon

# explicitly set.

DefaultIcon /icons/unknown.gif

# DefaultIcon 為那些沒有顯式定義圖示的檔案提供處理

# AddDescription allows you to place a short description after a file in

# server-generated indexes.  These are only displayed for FancyIndexed

# directories.

# Format: AddDescription "description" filename

#AddDescription "GZIP compressed document" .gz

#AddDescription "tar archive" .tar

#AddDescription "GZIP compressed tar archive" .tgz

# AddDescription允許你在server-generated索引後放置一個簡短的說明。

# 隻對FancyIndexed指令有效。

# 格式:AddDescription "說明" 檔案名

# AddDescription "GZIP compressed document" .gz

# AddDescription "tar archive" .tar

# AddDescription "GZIP compressed tar archive" .tgz

# ReadmeName is the name of the README file the server will look for by

# default, and append to directory listings.

# HeaderName is the name of a file which should be prepended to

# directory indexes. 

ReadmeName README.html

HeaderName HEADER.html

# ReadmeName指定伺服器預設查找的README檔案的名字,并添加到目錄清單中

# HeaderName指定目錄清單字首檔案的檔案名

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

# and not include in the listing.  Shell-style wildcarding is permitted.

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

# IndexIgnore指定目錄索引忽略并且不包含在清單中的檔案名集合,

# 支援shell類型的通配符。

# DefaultLanguage and AddLanguage allows you to specify the language of 

# a document. You can then use content negotiation to give a browser a 

# file in a language the user can understand.

# DefaultLanguage和AddLanguage允許你指定文檔的語言。

# 這使你可以讓使用者用容易了解的語言浏覽文檔。

# Specify a default language. This means that all data

# going out without a specific language tag (see below) will 

# be marked with this one. You probably do NOT want to set

# this unless you are sure it is correct for all cases.

# * It is generally better to not mark a page as 

# * being a certain language than marking it with the wrong

# * language!

# DefaultLanguage nl

# 指定預設的語言,這意味着所有沒有指定語言的包都将使用該語言。

# 多數情況下,你也許并不想設定它,除非你确信這樣做是正确的。

# 通常,不使用确定的語言比使用錯誤的語言要好。

# Note 1: The suffix does not have to be the same as the language

# keyword --- those with documents in Polish (whose net-standard

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

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

# 注意1:作為語言關鍵字的詞綴毫無疑問是不能一樣的--采用波蘭

# 文的文檔(網絡标準語言代碼是pl)将希望使用“AddLanguage pl .po”

# 來避免與perl腳本的一般詞綴産生二義性。

# Note 2: The example entries below illustrate that in some cases 

# the two character 'Language' abbreviation is not identical to 

# the two character 'Country' code for its country,

# E.g. 'Danmark/dk' versus 'Danish/da'.

# 注意2: 下面的例子舉例說明在一些範例中語言的二字元縮寫與它的國家

# 的二字元縮寫不相同,例如 “Danmark/dk” 和 “Danmark/da” 的比較.

# Note 3: In the case of 'ltz' we violate the RFC by using a three char

# specifier. There is 'work in progress' to fix this and get

# the reference data for rfc1766 cleaned up.

# 注意3: 在 “ltz” 的情況下我們使用三字元詞綴,違犯了 RFC的規定,

# 運作中将修複它并使用RFC1766标準取得參考資料。

# Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)

# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)

# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)

# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)

# Norwegian (no) - Polish (pl) - Portugese (pt)

# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)

# Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)

AddLanguage ca .ca

AddLanguage cs .cz .cs

AddLanguage da .dk

AddLanguage de .de

AddLanguage el .el

AddLanguage en .en

AddLanguage eo .eo

AddLanguage es .es

AddLanguage et .et

AddLanguage fr .fr

AddLanguage he .he

AddLanguage hr .hr

AddLanguage it .it

AddLanguage ja .ja

AddLanguage ko .ko

AddLanguage ltz .ltz

AddLanguage nl .nl

AddLanguage nn .nn

AddLanguage no .no

AddLanguage pl .po

AddLanguage pt .pt

AddLanguage pt-BR .pt-br

AddLanguage ru .ru

AddLanguage sv .sv

AddLanguage zh-CN .zh-cn

AddLanguage zh-TW .zh-tw

# LanguagePriority allows you to give precedence to some languages

# in case of a tie during content negotiation.

# Just list the languages in decreasing order of preference. We have

# more or less alphabetized them here. You probably want to change this.

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

# LanguagePriority允許你在會話過程中優先使用一些語言。

# 以優先次序遞減的方式列出它們。我們或多或少地采用按字母排列順序的方式

# 排列它們。也許你想要改變這個順序。

LanguagePriority en da nl et fr de el it ja ko no pl pt pt-br ltz ca es sv tw

# ForceLanguagePriority allows you to serve a result page rather than

# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)

# [in case no accepted languages matched the available variants]

ForceLanguagePriority Prefer Fallback

# ForceLanguagePriority 允許你為MULTIPLE CHOICES(Prefer)[在通訊的情況下]

# 或NOT ACCEPTABLE(Fallback)[沒有可接受的語言比對的情況]提供一個結果頁。

# Specify a default charset for all pages sent out. This is

# always a good idea and opens the door for future internationalisation

# of your web site, should you ever want it. Specifying it as

# a default does little harm; as the standard dictates that a page

# is in iso-8859-1 (latin1) unless specified otherwise i.e. you

# are merely stating the obvious. There are also some security

# reasons in browsers, related to javascript and URL parsing

# which encourage you to always set a default char set.

AddDefaultCharset UTF-8

# 為發送出的所有頁指定預設的字元集,這總是一個好主意,并且為你的

# web站點的國際化打開了大門,這不正是你曾經想要的嗎。同樣地,指定

# 預設字元集有一些小的損害,如一個使用iso-8859-1(latin1)标準指令

# 的頁面,除非以别的方式指定例如你僅僅以顯式方式聲明它。

# 也有一些與那些總是鼓勵你使用預設字元集的javascropt和URL文法有關

# 的浏覽器安全原因。

# Commonly used filename extensions to character sets. You probably

# want to avoid clashes with the language extensions, unless you

# are good at carefully testing your setup after each change.

# official list of charset names and their respective RFCs.

AddCharset ISO-8859-1  .iso8859-1  .latin1

AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen

AddCharset ISO-8859-3  .iso8859-3  .latin3

AddCharset ISO-8859-4  .iso8859-4  .latin4

AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru

AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb

AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk

AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb

AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk

AddCharset ISO-2022-JP .iso2022-jp .jis

AddCharset ISO-2022-KR .iso2022-kr .kis

AddCharset ISO-2022-CN .iso2022-cn .cis

AddCharset Big5        .Big5       .big5

# For russian, more than one charset is used (depends on client, mostly):

AddCharset WINDOWS-1251 .cp-1251   .win-1251

AddCharset CP866       .cp866

AddCharset KOI8-r      .koi8-r .koi8-ru

AddCharset KOI8-ru     .koi8-uk .ua

AddCharset ISO-10646-UCS-2 .ucs2

AddCharset ISO-10646-UCS-4 .ucs4

AddCharset UTF-8       .utf8

# 一般以檔案擴充名的方式使用字元集。也許你想要避免與語言擴充發生

# 碰撞,除非你在每次改變後都做了很好的測試。

# 的名字清單和它們各自的RFCs。

# The set below does not map to a specific (iso) standard

# but works on a fairly wide range of browsers. Note that

# capitalization actually matters (it should not, but it

# does for some browsers).

# for a list of sorts. But browsers support few.

AddCharset GB2312      .gb2312 .gb 

AddCharset utf-7       .utf7

AddCharset utf-8       .utf8

AddCharset big5        .big5 .b5

AddCharset EUC-TW      .euc-tw

AddCharset EUC-JP      .euc-jp

AddCharset EUC-KR      .euc-kr

AddCharset shift_jis   .sjis

# 下面的字元集沒有映射到一個特定的标準(iso)上,但是它們在浏覽器

# 中被廣泛的支援。注意那些大寫字母。

# (它不應該,但是它是為相容一些浏覽器而做)

# 它們的清單。但是浏覽器支援較少。

# AddType allows you to add to or override the MIME configuration

# file mime.types for specific file types.

#AddType application/x-tar .tgz

# AddType允許你為指定的檔案類型添加或覆寫mime.types檔案中配置的MIME

# AddEncoding allows you to have certain browsers uncompress

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

# Despite the name similarity, the following Add* directives have nothing

# to do with the FancyIndexing customization directives above.

#AddEncoding x-compress .Z

#AddEncoding x-gzip .gz .tgz

# If the AddEncoding directives above are commented-out, then you

# probably should define those extensions to indicate media types:

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

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

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

# or added with the Action directive (see below)

# To use CGI scripts outside of ScriptAliased directories:

# (You will also need to add "ExecCGI" to the "Options" directive.)

#AddHandler cgi-script .cgi

# AddHandler允許你映射确定的檔案擴充名到“handlers”:

# 與檔案類型無關的行為。這既能編譯到伺服器中也可以添加到Action指令

# 中(看下面)。

# 為了在ScriptAliased指令指定的以外使用CGI腳本:

#(要使它可用,你還需要在Options中添加“ExecCGI”。

# AddHandler cgi-script .cgi

# For files that include their own HTTP headers:

#AddHandler send-as-is asis

# For server-parsed imagemap files:

AddHandler imap-file map

# 對于那些包含他們自己的HTTP頭的檔案

# AddHandler send-as-is asis

# 對于server-parsed imagemap檔案:

# AddHandler imap-file map

# For type maps (negotiated resources):

# (This is enabled by default to allow the Apache "It Worked" page

#  to be distributed in multiple languages.)

AddHandler type-map var

# Filters allow you to process content before it is sent to the client.

# To parse .shtml files for server-side includes (SSI):

# (You will also need to add "Includes" to the "Options" directive.)

AddType text/html .shtml

AddOutputFilter INCLUDES .shtml

# agemap 檔案:

#AddHandler imap- 檔案映像

# 對于類型映像:(轉移資源)

#(這是預設的設定以允許Apache的“It Worked”頁能多種語言分發)。

# 過濾器允許你在将它發送到用戶端前進行處理。

# 為了在伺服器端分析包含(SSI)的.shtml文檔:

# (要執行這個指令,你還需要在Options指令中添加“Includes”。)

# AddType text/html .shtml

# AddOutputFilter INCLUDES .shtml

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

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

# pathnames for oft-used CGI file processors.

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

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

# Action讓你定義當調用比對的媒體檔案時将要執行的腳本。這将減少

# 那些經常使用的CGI腳本的URL路徑名的重複輸入。

# 格式:Action media/type /cgi-script/location

# 格式:Action handler-name /cgi-script/location

# Customizable error responses come in three flavors:

# 1) plain text 2) local redirects 3) external redirects

# Some examples:

#ErrorDocument 500 "The server made a boo boo."

#ErrorDocument 404 /missing.html

#ErrorDocument 404 "/cgi-bin/missing_handler.pl"

# 可配置的錯誤應答有三種風格:

# 1)plain text 2)local redirects 3) external redirects

# 一些示例:

# ErrorDocument 500 "The server made a boo boo."

# ErrorDocument 404 /missing.html

# ErrorDocument 404 "/cgi-bin/missing_handler.pl"

# Putting this all together, we can internationalize error responses.

# We use Alias to redirect any /error/HTTP_<error>.html.var response to

# our collection of by-error message multi-language collections.  We use 

# includes to substitute the appropriate text.

# 綜合應用這些指令,我們可以建立一個國際化的出錯應答。

# 我們使用Alias來重定向任意/error/HTTP_.html.var應答到

# 我們的多語言錯誤消息集合。使用正确的文本替代它。

# You can modify the messages' appearance without changing any of the

# default HTTP_<error>.html.var files by adding the line:

#   Alias /error/include/ "/your/include/path/"

# which allows you to create your own set of files by starting with the

# /var/www/error/include/ files and

# copying them to /your/include/path/, even on a per-VirtualHost basis.

Alias /error/ "/var/www/error/"

<IfModule mod_negotiation.c>

<IfModule mod_include.c>

    <Directory "/var/www/error">

        AllowOverride None

        Options IncludesNoExec

        AddOutputFilter Includes html

        AddHandler type-map var

        Order allow,deny

        Allow from all

        LanguagePriority en es de fr

        ForceLanguagePriority Prefer Fallback

    </Directory>

# 通過加入下面的行,你就能夠改變這些消息的顯示,而不必改變

# HTTP_.html.var檔案。

# Alias /error/include/ "/your/include/path/"

# 以将/usr/local/apache2/error/include/下的檔案拷貝到/your/inclue/path/下

# 開始,你可以建立你自己的檔案集合,甚至是其于每個虛拟主機的。

# 不管你的ServerSignature如何設定,預設的包含檔案将顯示你的

# Aapche版本号和你的ServerAdmin郵件位址

# 國際化的錯誤文檔需要mod_alias,mod_include和mod_negotiation三個

# 子產品。要激活它們,取消下面30行的注釋符号

# Alias /error/ "/usr/local/apache2/error/"

# Options IncludesNoExec

# AddOutputFilter Includes html

# AddHandler type-map var

# Allow from all

# LanguagePriority en de es fr it nl sv

# ForceLanguagePriority Prefer Fallback

#    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var

#    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var

#    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var

#    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

#    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var

#    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

#    ErrorDocument 410 /error/HTTP_GONE.html.var

#    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var

#    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var

#    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

#    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var

#    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

#    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var

#    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var

#    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var

#    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var

#    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

# The following directives modify normal HTTP response behavior to

# handle known problems with browser implementations.

BrowserMatch "Mozilla/2" nokeepalive

BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4\.0" force-response-1.0

BrowserMatch "Java/1\.0" force-response-1.0

BrowserMatch "JDK/1\.0" force-response-1.0

# 下面的指令更改标準的HTTP應答行為以處理己知的浏覽器問題。

BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4.0" force-response-1.0

BrowserMatch "Java/1.0" force-response-1.0

BrowserMatch "JDK/1.0" force-response-1.0

# The following directive disables redirects on non-GET requests for

# a directory that does not include the trailing slash.  This fixes a 

# problem with Microsoft WebFolders which does not appropriately handle 

# redirects for folders with DAV methods.

# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully

BrowserMatch "^WebDrive" redirect-carefully

BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully

BrowserMatch "^gnome-vfs" redirect-carefully

# 下面指令關閉對那些沒有尾部“/”的目錄的非GET請求的重定向,

# 這些指令修複了微軟的采用DAV方法不能正确處理重定向的WEB檔案夾的問題。

# Apple下的DAV檔案系統和Gnome下的VFS對DAV的支援也是采用這樣的方法

# 進行處理的。

# Allow server status reports generated by mod_status,

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

#<Location /server-status>

#    SetHandler server-status

#    Order deny,allow

#    Deny from all

#    Allow from .example.com

#</Location>

# 成并報告伺服器狀态資訊。改變.example.com為你自己的域名。

# SetHandler server-status

# Order deny,allow

# Deny from all

# Allow from .example.com

# Allow remote server configuration reports, with the URL of

#<Location /server-info>

#    SetHandler server-info

# (需要mod_info.c支援)。改變“.example.com”為你自己的域名。

# SetHandler server-info

# Proxy Server directives. Uncomment the following lines to

# enable the proxy server:

#<IfModule mod_proxy.c>

#ProxyRequests On

#<Proxy *>

#</Proxy>

# 代理伺服器指令,去掉下面的行使代理服務可用。

# ProxyRequests On

# Enable/disable the handling of HTTP/1.1 "Via:" headers.

# ("Full" adds the server version; "Block" removes all outgoing Via: headers)

# Set to one of: Off | On | Full | Block

#ProxyVia On

# 安裝或關閉HTTP/1.1“通道”頭處理。

# (“Full”添加伺服器版本資訊,“Block”移掉所有輸出“通道”頭資訊。

# 可以設為下面各選項之一:Off | On | Full | Block

# ProxyVia On

# To enable a cache of proxied content, uncomment the following lines.

#<IfModule mod_disk_cache.c>

#   CacheEnable disk /

#   CacheRoot "/var/cache/mod_proxy"

#</IfModule>

# End of proxy directives.

# 最好為代理服務安裝高速緩沖,去掉下面幾行的注釋符号:

# (沒有CacheRoot則不緩沖)

### Section 3: Virtual Hosts

# VirtualHost: If you want to maintain multiple domains/hostnames on your

# machine you can setup VirtualHost containers for them. Most configurations

# use only name-based virtual hosts so the server doesn't need to worry about

# IP addresses. This is indicated by the asterisks in the directives below.

# Please see the documentation at 

# for further details before you try to setup virtual hosts.

# You may use the command line option '-S' to verify your virtual host

# configuration.

# Use name-based virtual hosting.

#NameVirtualHost *:80

# NOTE: NameVirtualHost cannot be used without a port specifier 

# (e.g. :80) if mod_ssl is being used, due to the nature of the

# SSL protocol.

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

# server name.

#<VirtualHost *:80>

#    DocumentRoot /www/docs/dummy-host.example.com

#    ServerName dummy-host.example.com

#    ErrorLog logs/dummy-host.example.com-error_log

#    CustomLog logs/dummy-host.example.com-access_log common

#</VirtualHost>

## 第三區:虛拟主機

# VirtualHost:你可以通過設定虛拟主機容器以實作在你的主機上保有多個

# 域名/主機名。大多數配置資訊隻使用基于名字的虛拟主機,是以伺服器

# 不必擔心IP位址的問題,下面的指令以*号代替虛拟主機名。

# 在你試着配置你的虛拟主機以前,請參見

# 你可以使用指令行選項“-S”來檢驗你的虛拟主機配置。

# 使用基于名字的虛拟主機。

# NameVirtualHost *

# 虛拟主機示例:

# 幾乎所有的Apache指令都可以在虛拟主機容器中使用。

# 第一個虛拟主機區是用于向服務名未知的請求進行應答的配置。

# <VirtualHost *>

# DocumentRoot /www/docs/dummy-host.example.com

# ServerName dummy-host.example.com

# ErrorLog logs/dummy-host.example.com-error_log

# CustomLog logs/dummy-host.example.com-access_log commom

# </virtualHost>

     本文轉自yangming1052 51CTO部落格,原文連結:http://blog.51cto.com/ming228/108521,如需轉載請自行聯系原作者

繼續閱讀