1. 程式人生 > >apache主要配置詳解

apache主要配置詳解

1.

# Deny access to the entirety of your server's filesystem. You must

# explicitly permit access to web content directories in other

# <Directory> blocks below.

#拒絕所有對你伺服器檔案系統的訪問。你必須在下面其它的<Directory>區明確許可訪問web內容目錄

#

<Directory />

    AllowOverride none

    Require all denied

</Directory>

2.

# 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:你要使用【serve】的文件的目錄。預設為所有請求都從這個目錄獲取,但是可以使用符號連線【symbolic link】和別名指定其它位置。

#【下面這個指令指定文件目錄,也就是網站的根目錄】

DocumentRoot "c:/Apache24/htdocs"

<Directory "c:/Apache24/htdocs">

    #

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

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #可能的設定指令值是“None”,“All”,或者以下任意組合:

    #Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

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

    # doesn't give it to you.

    #注意那個"MultiViews"必須準確命名-----“Options All”將不會起什麼作用【doesn't give it to you】【?】

    #

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

    # http://httpd.apache.org/docs/2.4/mod/core.html#options

# for more information.

    #

    Options Indexes FollowSymLinks

    #

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

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

#   AllowOverride FileInfo AuthConfig Limit

# AllowOverride控制的指令可能包含在.htaccess檔案中。它可以是“all”、“None”、或以下關鍵字的任意組合:

# AllowOverride FileInfo AuthConfig Limit

    #

    AllowOverride None

    #

# Controls who can get stuff from this server.

#下面的指令控制誰能從這臺伺服器上獲取東西

    #

    Require all granted

</Directory>

3.

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

# is requested.

# DirectoryIndex:設定當Apache服務得到一個目錄請求的時候訪問的檔案【即預設首頁】

#

<IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

4.

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

# viewed by Web clients.

#下面的行禁止.htaccess和.htpasswd檔案被web客戶端檢視【禁止從瀏覽器訪問.htaccess和.htpasswd檔案】

#

<Files ".ht*">

    Require all denied

</Files>


5.

# 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:錯誤日誌檔案的位置。如果你沒有在<VirtualHost>容器中指定一個ErrorLog指令,與那個虛擬主機相關的錯誤消失將記錄在這裡。如果你確實為一個<VirtualHost>容器定義了錯誤訊息檔案,那麼主機的錯誤日誌將被記錄在那裡而不是這裡。

#

ErrorLog "logs/error.log"


6.

<IfModule alias_module>

    #

    # Redirect: Allows you to tell clients about documents that used to

    # exist in your server's namespace, but do not anymore. The client

# will make a new request for the document at its new location.

#Redirect:允許你通知客戶端以前存在於伺服器名字空間的文件,現在已經不存在了。客戶端將傳送一個新請求以獲得新的文件位置。

    # Example:

# Redirect permanent /foo http://www.example.com/bar

    #

    # Alias: Maps web paths into filesystem paths and is used to

# access content that does not live under the DocumentRoot.

# Alias:別名,對映網路路徑到檔案系統路徑並被且用於訪問不存在於網站根目錄的內容。

    # Example:

    # Alias /webpath /full/filesystem/path

    #

    # If you include a trailing / on /webpath then the server will

    # require it to be present in the URL.  You will also likely

    # need to provide a <Directory> section to allow access to

# the filesystem path.

#如果你包含了 trainng/on/webpath 那麼伺服器將獲取它並呈現在URL中。【?】

    #

    # ScriptAlias: This controls which directories contain server scripts.

    # ScriptAliases are essentially the same as Aliases, except that

    # documents in the target 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:指令碼別名,它控制著那些包含伺服器指令碼的目錄。“指令碼別名”本質上與“別名”是相同的,除非目標目錄中的文件被當作應用程式對待並且當被請求時由伺服器執行而不是當作文件被髮送到客戶端。【當目標目錄中的文件是應用程式,客戶端有請求時被伺服器執行,而不是以文件形式被髮送到客戶端,只有這個時候指令碼別名與別名是不同的】【?】。以斜槓“/”結尾這個規則對於ScriptAlias和Alias指令是相同的。

    #

    ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"

</IfModule>


7.

<IfModule mime_module>

    #

    # TypesConfig points to the file containing the list of mappings from filename extension to MIME-type.

# TypesConfig指向一個檔案,這個檔案包含一個從副檔名到mime-type的對映列表【TypesConfig指向一個檔案,這個檔案包含一個副檔名與mime-type的對映列表】

    #

    TypesConfig conf/mime.types

    #

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

# file specified in TypesConfig for specific file types.

# AddType允許你為特殊的檔案型別新增或覆蓋在TypesConfig中規定的mime配置檔案

    #

    #AddType application/x-gzip .tgz

    #

    # AddEncoding allows you to have certain browsers uncompress information on the fly. Note: Not all browsers support this.

# AddEncoding允許你有特定的瀏覽器解壓縮資訊的自適應能力。注意:並非所有瀏覽器都支援。

    #

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

#如果上面的AddEncoding指令被註釋,那麼你可能應該定義那些副檔名以指出媒體型別。

    #

    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)

# AddHandler允許你對映特定副檔名到"handlers":動作與檔案型別無關。這也可以內建於伺服器或者與動作指令【Action directive】一起新增(看下面)

    #

    # To use CGI scripts outside of ScriptAliased directories:

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

    #為了在指令碼別名指定的目錄外使用CGI指令碼:(你也需要新增"ExecCGI"到"Options"指令)

    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):為了型別對映(協議資源)【?】

    #AddHandler type-map var

    #

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

# Filters允許你在內容被髮送到客戶端之前處理它。

    #

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

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

    #為“伺服器端包含”分析.shtml檔案:(你也需要新增“includes”到"Options"指令)

    #AddType text/html .shtml

    #AddOutputFilter INCLUDES .shtml

</IfModule>


8.

# Customizable error responses come in three flavors:

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

#可定製的錯誤響應支援三種方式:1)明文 2)本地重定向 3)外部重定向

# Some examples:

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

#ErrorDocument 404 /missing.html

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

#ErrorDocument 402 http://www.example.com/subscription_info.html

#

#

# MaxRanges: Maximum number of Ranges in a request before

# returning the entire resource, or one of the special

# values 'default', 'none' or 'unlimited'.

# Default setting is to accept 200 Ranges.

# MaxRanges:定義了在一個請求返回全部資源之前Ranges的最大數字,或者在'default', 'none' or 'unlimited'三個值中指定的一個值。

#MaxRanges unlimited


9.

# Server-pool management (MPM specific)

#伺服器池管理

#Include conf/extra/httpd-mpm.conf

# Multi-language error messages 多語言錯誤訊息

#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings動態目錄列表形式配置

#Include conf/extra/httpd-autoindex.conf

# Language settings 語言設定

#Include conf/extra/httpd-languages.conf

# User home directories 使用者家庭目錄

#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration 請求和配置上的實時資訊

#Include conf/extra/httpd-info.conf

# Virtual hosts 虛擬主機

#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual 本地訪問Apache Http Server手冊。

#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV) 分散式創作和版本控制

#Include conf/extra/httpd-dav.conf

# Various default settings 多種類預設設定

#Include conf/extra/httpd-default.conf


10.

# Configure mod_proxy_html to understand HTML4/XHTML1 配置mod_proxy_html,使它支援HTML4/XHTML1

<IfModule proxy_html_module>

Include conf/extra/proxy-html.conf

</IfModule>

# Secure (SSL/TLS) connections安全連線

#Include conf/extra/httpd-ssl.conf


相關推薦

apache主要配置

1. # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other

Centos 6 apache httpd 2.2 主要配置( 一 )

apache 2.2 httpd2.2 centos 6 實驗環境:VMware Workstation Pro 14(試用版) 系統平臺: CentOS release 6.9 (Final) 內核 2.6.32-696.el6.x86_64 Server versio

Centos 6 apache httpd 2.4 主要配置

apache 2.4實驗環境:VMware Workstation Pro 14(試用版) 系統平臺: CentOS release 6.9 (Final) 內核 2.6.32-696.el6.x86_64 Server version: Apache/2.4.29 (Unix)

Apache配置

詳解 ken 規則 符號連接 start 安裝 format str 訪問 Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd.conf文件中修改。 主站點的配置(基本配置) (1) 基本配置: ServerRoot "/mnt/soft

Apache配置 帶圖

image 允許 p s linu 配置詳解 mut 內存 support http 目錄 Apache 的配置詳解 帶圖 1.01 ServerRoot 配置 1.02?Mutex default:logs 1.03?Listen 配置 1.04 Dynamic Sha

ubuntu中apache配置

在ubuntu中,apache是跟php一起安裝的,如果安裝啟動成功,開啟瀏覽器輸入localhost,可以看到一個關於apache的引導說明頁,裡面包含了很多東西,下面對apache引導頁說明和配置

Apache配置

搜索 相對 第一個 form 執行權限 php 時有 多個 direct Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd.conf文件中修改。 主站點的配置(基本配置) (1) 基本配置: ServerRoot "/mnt/softwa

CentOS Apache配置

先來 page over oca 基於ip chmod 程序 ror 接收 要想在linux上實現網頁服務器(www)需要Apache這個服務器軟件,不過Apache僅能提供最基本的靜態網站數據而已,想要實現動態網站的話,最好還是要PHP與MySQL的支持,所以下面我們將會

Apache虛擬主機配置

Apache虛擬主機分類詳解 Apache基於IP虛擬主機配置 Apache基於域名的虛擬主機配置 Apache基於端口的虛擬主機配置 Apache虛擬主機配置詳解1、配置環境說明系統環境:CentOS7Apache環境:編譯安裝的httpd-2.4.7系統限制:關閉了防火墻和selinux

Apache日誌輪詢配置

Apache日誌輪詢介紹 Apache日誌輪詢配置 Apache虛擬主機日誌輪詢 Apache日誌輪詢配置詳解1、apache日誌輪詢作用隨著服務器的不斷運行,日誌文件會越來越大,如果不小心把日誌文件放到了/var之類位置,日誌文件可能寫滿分區,從而導致服務器被迫停止運行。這種事情確實曾經發生過。

httpd/apache編譯安裝配置

apachectl 訪問 這一 block combined enable config yum 開發環境 一.httpd介紹 1.httpd是http協議的一個經典實現,也是apache組織中的一個頂級項目,其官方站點為httpd.apache.org。 2.httpd的

0 httpd2.2配置-Apache配置檔案-(二)

httpd-2.2 15 curl命令 curl是基於URL語法在命令列方式下工作的檔案傳輸工具,它支援FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE及LDAP等協議。curl支援HTTPS認證,並且支援HTTP的POST、PU

0 httpd2.2配置-Apache配置文件-(二)

切換 more 簡化 css 程序 ip地址 在服務器 filter utf httpd-2.2 15 curl命令 curl是基於URL語法在命令行方式下工作的文件傳輸工具,它支持FTP, FTPS, HTTP, HTTPS, GOPHER,

[Kafka] Apache Kafka 簡介、叢集搭建及配置

前言 kafka是一種高吞吐量的分散式釋出訂閱訊息系統,它可以處理消費者規模的網站中的所有動作流資料。這種動作(網頁瀏覽,搜尋和其他使用者的行動)是在現代網路上的許多社會功能的一個關鍵因素。這些資料通常是由於吞吐量的要求而通過處理日誌和日誌聚合來解決。 Kafk

Apache httpd.conf配置

常用配置指令說明 1. ServerRoot:伺服器的基礎目錄,一般來說它將包含conf/和logs/子目錄,其它配置檔案的相對路徑即基於此目錄。預設為安裝目錄,不需更改。 語法:ServerRoot directory-path 如: ServerRoot "/usr/local/apache-2.2

apache url rewrite實現url重寫配置

如果你是apache伺服器要實現url rewrite重寫我們需要在apache中開啟mod_rewrite.so配置,下面我把具體過程給各位同學詳細介紹介紹。 配置步驟: 第一步:找到apache的配置檔案httpd.conf(檔案在conf目錄下) 第二步:你首先必

使用Apache模組編譯安裝搭建LAMP平臺以及部署DedeCMS網站配置

一、LAMP平臺概述 簡介: LAMP架構是目前成熟的企業網站應用模式之一,指的是協同工作的一整套系統和相關軟體,能夠提供動態web站點服務及其應用開發環境。LAMP是一個縮寫詞,具體包括Linux作業系統、Apache網站伺服器、MySQL資料庫伺服器、PHP(或Perl

使用apache和nginx代理實現tomcat負載均衡及叢集配置

實驗環境: 1、nginx的代理功能 nginx proxy: eth0: 192.168.8.48 vmnet2 eth1: 192.168.10.10 tomcat server1: vmnet2 eth0: 192.168.10.20 tomcat server

Apache服務以及httpd.conf配置

Apache服務架設  一、Apache服務總覽:  1、所需要的軟體包:httpd   httpd-devel   httpd-manual  2、埠:80(http)  443(https)  3、主配置檔案:/etc/httpd/* 、/var/www/*  4、預設

Apache目錄訪問許可權配置

給指定的資料夾配置對應的訪問許可權是Apache配置中的基礎應用,也是Apache使用者的必備技能之一。 在Apache配置檔案中,給指定目錄設定基本的訪問許可權,主要是靠Allow、Deny、Order三個指令的配合使用來實現的。 1.Allow指令 Allow指