国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Apache配置文件解讀學習筆記

seal_de / 994人閱讀

摘要:媒體文件,以及相關文件解析配置說明此區域文件主要包含一些文件支持,以及添加一些指令在給定的文件擴展名與特定的內容類型之間建立映射關系。模式使用多個子進程,每個子進程有多個線程。

Apache配置解釋

ServerRoot

 # ServerRoot: The top of the directory tree under which the server"s
 # configuration, error, and log files are kept.

主要用于指定Apache的安裝,此選項參數值在安裝Apache的時候系統會自動把Apache路徑寫入。


Mutex default:logs

  #Mutex: Allows you to set the mutex mechanism and mutex file
  #directory
  #for individual mutexes, or change the global defaults

互斥:允許為多個不同的互斥對象設置互斥機制(nutex mechanism)和互斥文件目錄,或者修改全局默認值。如果互斥的對象是基于文件的以及默認的互斥目錄不在本地磁盤或因為其他原因而不適用,那么取消注釋并改變目錄。


Listen

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the 
# directive.

listen主要偵聽web服務器端口狀態,默認為80。也可以寫成IP地址,不寫地址的默認為0.0.0.0


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
#

Apache是一個模塊化設計的服務,核心只包含主要功能,擴展功能通過模塊實現,不同的模塊可以被靜態的編譯進程序,也可以動態加載。

主要用于添加Apache一些動態模塊,比如php支持模塊。重定向模塊,認證模塊支持,注意如果需要添加某些模塊支持,只需把相關模塊前面注釋符號取消掉


Apache 運行用戶配置


#
# 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.
# It is usually good practice to create a dedicated user and group >   >     # for
# running httpd, as with most system services.
#
User daemon
Group daemon

指定Apache服務的運行用戶和用戶組,默認為:daemon


Apache的默認服務名及端口設置

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

ServerName localhost:80

用以指定Apache默認的服務器名以及端口,默認的參數配置為ServerName localhost:80


Apache服務默認管理員地址設置

# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages,
# such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin admin@example.com

指定Apache服務管理員通知郵箱地址,選擇默認值即可,如果有真實的郵箱地址也可以設置此值


HostnameLookups

HostnameLookups off

是否進行域名的解析,一般關掉,會占用資源,而且一般的ip地址沒有反向解析,或者不允許.


DocumentRoot

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

默認的網站根目錄

主站點的網頁存儲位置


Apache根目錄訪問控制設置,以及默認的網站根目錄訪問控制

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

    AllowOverride none
    Require all granted

Apache的根目錄訪問控制設置,針對用戶對根目錄下所有的訪問權限控制,默認Apache對根目錄訪問都是拒絕訪問。

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

    #
    # Controls who can get stuff from this server.
    #

#   onlineoffline tag - don"t remove
#    Require local
Allow from all

Apache的默認網站根目錄設置及訪問控制

Options Indexex FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

options:配置在特定目錄中適用哪些特性,常用參數

參數 含義
ExecCGI 在該目錄下允許執行CGI腳本
FollowSymLinks 在該目錄下允許文件系統使用符號鏈接
Indexes 當用戶訪問該目錄時,如果用戶找不到DirectoryIndex指定的主頁文件(例如index.html),則返回該目錄下的文件列表給用戶。
SymLinksIfOwnerMatch 當使用符號連接時,只有當符號連接的文件擁有者與實際文件的擁有者相同時才可以訪問。

AllowOverride:允許存在于.htaccess文件中的指令類型(.htaccess文件名是可以改變的,其文件名由AccessFileName指令決定)。
當AllowOverride設置為none時,不搜索該目錄下的htaccess文件(可以減小服務器的開銷)

Order:控制在訪問Allow和deny兩個訪問規則那個優先

Allow:允許訪問的主機列表(可用域名或者子網)

Deny: 拒絕訪問的主機列表


Apache 默認首頁設置

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

    DirectoryIndex index.php index.php3 index.html index.htm

設置Apache默認支持的首頁,默認只支持:index.html首頁,如要支持其他類型的首頁,需要在此區域添加


Apache關于.ht文件訪問配置

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#

    Require all denied

此選項是針對 .ht 文件訪問控制,默認具有訪問權限,此區域文件默認即可


Apache關于日志文件配置

# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn


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

    
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
    

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a 
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per- access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "/####/logs/access.log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access.log" combined

針對Apache默認的日志級別,默認的訪問日志路徑,默認的錯誤日志路徑等相關設置,此選項內容默認即可


URL重定向,cgi模塊配置說明


    #
    # 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.
    # 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.
    # 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  section to allow access to
    # the filesystem path.

    #
    # 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 /cgi-bin/ "/####/cgi-bin/"




    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock cgisock


# "/####/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#

    AllowOverride None
    Options None
    Require all granted

包含一些url重定向,別名,腳本別名等相關設置,以及一些特定的處理程序,CGI設置說明。


MIME媒體文件,以及相關http文件解析配置說明


    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to 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 application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    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
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3

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

    # For type maps (negotiated resources):
    #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

此區域文件主要包含一些mime文件支持,以及添加一些指令在給定的文件擴展名與特定的內容類型之間建立映射關系。比如添加對PHP文件擴展名映射關系


服務器頁面提示設置

#
# 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.
#
#MIMEMagicFile conf/magic

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

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
#
EnableMMAP off
EnableSendfile off

此區域可以定制訪問錯誤相應提示,支持三種方式:1明文,2本地重定向,3外部重定向,另外還包括內存映射或者“發送文件系統調用”可被用于分發文件等配置


# AcceptFilter: On Windows, none uses accept() rather than AcceptEx() and
# will not recycle sockets between connections. This is useful for network
# adapters with broken driver support, as well as some virtual network
# providers such as vpn drivers, or spam, virus or spyware filters.
AcceptFilter http none
AcceptFilter https none

Apache服務器補充設置

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

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

# Configure mod_proxy_html to understand HTML4/XHTML1

Include conf/extra/proxy-html.conf

此區域包括:服務器池管理,多語言錯誤信息,動態目錄列表 形式配置,語言設置,用戶家庭目錄,請求和配置上的實時信息,虛擬主機


Apache服務器安全連接設置

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

#
# uncomment out the below to deal with user agents that deliberately
# violate open standards by misusing DNT (DNT *must* be a specific
# end-user choice)
#
#
#BrowserMatch "MSIE 10.0;" bad_DNT
#
#
#RequestHeader unset DNT env=bad_DNT
#

Include "C:/wamp64/alias/*"

此區域主要是關于服務器安全連接設置,用于使用https連接服務器等設置的地方

配置選項及參數含義

ServerTokens : 該參數設置http頭部返回的apache版本信息(僅軟件名稱,主版本,次版本,僅Apache的完整版本號,包括系統類型)

ServerSignature Off :在頁面產生錯誤時是否出現服務器版本信息。推薦設置為Off

持久性連接設置
KeepAlive On :開啟持久性連接功能。即當客戶端連接到服務器,下載完數據后仍然保持連接狀態。
MaxKeepAliveRequests 100: 一個連接服務的最多請求次數。
KeepAliveTimeout 30 : 持續連接多長時間,該連接沒有再請求數據,則斷開該連接。缺省為15秒。

Timeout 60 : 不論接收或發送,當持續連接等待超過60秒則該次連接就中斷

DefaultType text/plain DefaultType : 定義當不能確定MIME類型時服務器提供的默認MIME類型(默認不更改)
如果你的服務器主要包含text 或者HTML文檔,“text/plain” 是一個好的選擇

別名設置:對于不在DocumentRoot指定的目錄內的頁面,既可以使用符號連接,也可以使用別名。

CGI設置 :

日志的設置:

ErrorLog logs/error_log :日志的保存位置

LogLevel warn :日志的級別

訪問日志的設置

%h 客戶端的ip地址或主機名
%l 由客戶端 identd 判斷的RFC 1413身份,輸出中的符號 "-" 表示此處信息無效
%u 由HTTP認證系統得到的訪問該網頁的客戶名。有認證時才有效,輸出中的符號 "-" 表示此處信息無效。
%t 服務器完成對請求的處理時的時間。
"%r" 引號中是客戶發出的包含了許多有用信息的請求內容。
%>s 服務器返回給客戶端的狀態碼
%b 返回給客戶端的不包括響應頭的字節數
"%{Referer}i" 指明了該請求是從被哪個網頁提交過來的
"%{User-Agent}i" 客戶瀏覽器提供的瀏覽器識別信息


prefork和worker模式的比較

prefork模式使用多個子進程,每個子進程只有一個線程。每個進程在某個確定的時間只能維持一個連接。在大多數平臺上,Prefork MPM在效率上要比Worker MPM要高,但是內存使用大得多。prefork的無線程設計在某些情況下將比worker更有優勢:它可以使用那些沒有處理好線程安全的第三方模塊,并且對于那些線程調試困難的平臺而言,它也更容易調試一些。

worker模式使用多個子進程,每個子進程有多個線程。每個線程在某個確定的時間只能維持一個連接。通常來說,在一個高流量的HTTP服務器上,Worker MPM是個比較好的選擇,因為Worker MPM的內存使用比Prefork MPM要低得多。但worker MPM也由不完善的地方,如果一個線程崩潰,整個進程就會連同其所有線程一起"死掉".由于線程共享內存空間,所以一個程序在運行時必須被系統識別為"每個線程都是安全的"。

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/28631.html

相關文章

  • Apache Flink 1.9 重大特性提前解讀

    showImg(https://segmentfault.com/img/remote/1460000019961426); 今天在 Apache Flink meetup ·北京站進行 Flink 1.9 重大新特性進行了講解,兩位講師分別是 戴資力/楊克特,zhisheng 我也從看完了整個 1.9 特性解讀的直播,預計 Flink 1.9 版本正式發布時間大概是 7 月底 8 月初左右正式發...

    wall2flower 評論0 收藏0
  • 學習筆記PHP-01、Apache的下載與安裝

    下載Apache服務器 點我跳轉Apache下載頁面 showImg(https://segmentfault.com/img/bVbkrTn?w=1200&h=519); 然后將安裝包解壓到你想安裝的位置 我這里解壓到D:develop路徑 然后再修改D:developApache24conf目錄下的httpd.conf文件如下圖(注意斜線方向)showImg(https://segmentfa...

    blair 評論0 收藏0
  • 學習筆記PHP-01、Apache的下載與安裝

    下載Apache服務器 點我跳轉Apache下載頁面 showImg(https://segmentfault.com/img/bVbkrTn?w=1200&h=519); 然后將安裝包解壓到你想安裝的位置 我這里解壓到D:develop路徑 然后再修改D:developApache24conf目錄下的httpd.conf文件如下圖(注意斜線方向)showImg(https://segmentfa...

    omgdog 評論0 收藏0
  • 學習筆記PHP02、PHP的下載與安裝

    摘要:下載鏈接然后選擇如下圖所示的版本的解壓包下載。在解壓后的文件夾目錄下找到文件并引入該文件到配置文件中。引入過程如下編輯的配置文件,添加兩行代碼如下圖這兩行代碼用于加載與連接模塊和聲明目錄。 PHP下載鏈接 然后選擇如下圖所示Tread Safe的版本的Zi解壓包下載。showImg(https://segmentfault.com/img/bVbkF7k?w=1200&h=789);在...

    xiguadada 評論0 收藏0
  • 學習筆記PHP02、PHP的下載與安裝

    摘要:下載鏈接然后選擇如下圖所示的版本的解壓包下載。在解壓后的文件夾目錄下找到文件并引入該文件到配置文件中。引入過程如下編輯的配置文件,添加兩行代碼如下圖這兩行代碼用于加載與連接模塊和聲明目錄。 PHP下載鏈接 然后選擇如下圖所示Tread Safe的版本的Zi解壓包下載。showImg(https://segmentfault.com/img/bVbkF7k?w=1200&h=789);在...

    SKYZACK 評論0 收藏0

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<