澳门新萄京官方网站-www.8455.com-澳门新萄京赌场网址

澳门新萄京官方网站:配置文件中文版,conf配置

2019-09-11 作者:服务器运维   |   浏览(166)

Apache最新官方配置文件中文版。帮忙web服务器管理员更方便的对Apache进行配置。
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#参照NCSA服务器的配置文件,原版由Rob McCool发布
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:; for detailed information about
# the directives.
#这是Apache server的主配置文件. 它包含配置指令,来指示服务器
#请参考 了解关于指令的详细信息
# 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').
# 1. 控制Apache server的全局操作的指令(全局环境变量).
# 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.
# 2.配置主服务或者默认服务的指令,它针对那些被虚拟主机以外的请求作出响应.
#它也包含虚拟主机的一些默认参数
# 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.
# 3. 虚拟主机设置,这使得发往不同的ip或者主机名的请求可以被子同一个Apache服务# 器处理
# 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 "C:/Program Files/Apache Group/Apache2" will be interpreted by the
# server as "C:/Program Files/Apache Group/Apache2/logs/foo.log".
#配置和日志文件名:如果你所指定的文件名以”/”在Win32中以盘符:/)开头,服务器将以绝对路径来处理。如果不以”/”开头,则以相对于ServerRoot不解释,所以对于logs/foo.log来讲,当ServerRoot为"C:/Program Files/Apache Group/Apache2”时,则指的是
C:/Program Files/Apache Group/Apache2/logs/foo.log文件
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:apache").
注意,在文件名的定义中,必须用正斜杠,而不是反斜杠,如c:/apache而不是c:apache
# If a drive letter is omitted, the drive on which Apache.exe is located
# will be used by default. It is recommended that you always supply
# an explicit drive letter in absolute paths, however, to avoid
# confusion.
#如果省略了盘符,则以Apache.exe所在的盘符为默认值
建议在绝对路径中永远使用显式的盘符,这样有助于消除误解
### 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服务器,例如它所能处理的并发请求数或者它在哪里能够找到其配置文件
#
# 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 (available
# at <URL:;);
# you will save yourself a lot of trouble.
#注意:如果将其保存到NFS上或者网络上mounted的文件系统上,然后应该阅读LockFile文档,.
# Do NOT add a slash at the end of the directory path.
#不要在目录的末尾加上斜杠
ServerRoot "C:/Program Files/Apache Group/Apache2"
ServerRoot:根目录
#
# ScoreBoardFile: File used to store internal server process information.
# If unspecified (the default), the scoreboard will be stored in an
# anonymous shared memory segment, and will be unavailable to third-party
# applications.
ScoreBoardFile: 保存服务器内部的处理信息
如果未定议(默认状态),scoreboard将被保存在匿名的共享内存段中,并且对于第三方来讲,是不可获得的
# If specified, ensure that no two invocations of Apache share the same
# scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.
#如果已定义,应确保Apache的两个调用不能共享同一个scoreboard. Scoreboard文件必须存放在可分配的磁盘上
#ScoreBoardFile logs/apache_runtime_status
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#PidFile:当服务器起努时,服务器需要将其进程ID号存放在此文件中
PidFile logs/httpd.pid
#
# Timeout: The number of seconds before receives and sends time out.
#Timeout:接收和发送数据的超时设置,秒数
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#KeepAlive: 是否支持持久联接而不是每个请求建一个连接),设off关闭此功能
KeepAlive On
#
# 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:在持久连接期间,所允许的最大请求数量。设为0表示不作限制
建议设为较高的数,以提高性能
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#KeepAliveTimeout:在同一个客户连接中,等待下一个请求的等待时间。
KeepAliveTimeout 15
##
## Server-Pool Size Regulation (MPM specific)
## 常规Server-Pool服务器池的大小(每分钟M数)
# WinNT MPM WinNT 的MPM
# ThreadsPerChild: constant number of worker threads in the server process
ThreadPerChild:服务器进程中工作的线程数量
# MaxRequestsPerChild: maximum number of requests a server process serves
每个服务进程的最大请求数
<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild 0
</IfModule>
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#Listen:允许你将Apache绑定到指定的IP地址或端口,而不是默认端口,请同时参考<VirtualHost>指令
# 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)
#像下面那样指定侦听的IP地址,防止Apache抢占所有绑定的IP地址
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#动态共享对象支持DSO
# 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.
#为了能够使用模块功能,模块通常以DSO的方式构建,你应该在下面使用LoadModule行,使得能够在使用前获得指令的功能。静态编译模块在httpd-1中所列举的)不需要在此装载
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.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 autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so
LoadModule imap_module modules/mod_imap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so
#
# 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.
#扩展状态控制Apache是否产生完整的状态信息设为on产生全部),如果设为Off则产生基本的信息,当与server-status头有关,默认值为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.
#本节中指令的设置值,将被主服务所使用,主服务响应那些没有被<VirtualHost>所处理的请求,这些值也为<VirtualHost>容器提供了默认值,你可以在后面的文件中定义
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
所有这些指令将出现在<VirtualHost>容器中,这些设定值将在定义virtual host时被覆写。
#
#
# 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. [email protected]
# ServerAdmin:你的地址,当系统故障时,可以给你发email。此地址出现在那些由服务器生成的页面上,如出错文档。例如:[email protected]
ServerAdmin [email protected]
#
# 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.
#ServerNaem定义了server名称和端口号,用以标明自己的身份。通常可以自动定义,建议显式地定义,避免起动时出错
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#如果没有正确定义主机的DNS,服务器产生的重定向将不会工作,同时参考UseCanonicalName指令。
# 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.
#如果你没有注册DNS名字,请在这里输入IP地址。
你可以在任何情况下使用ip地址,这也使用得重定向变得敏感
ServerName www.moers.com: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:决定Apaceh如何构建自定参考URL,和SERVER_NAME及SERVER_PORT变量
当设为Off时,Apache将使用客户端给出的域名和端口。当设为On时,Apache将使用ServerName指令
UseCanonicalName Off
#
# 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:服务器文档放置目录。在默认情形下,所有的请求都从这里开始,除了记号和别名将改指它处以外。
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
#
# 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).
#每个可供Apache访问的目录,可以配置成允许或禁止哪些服务和特征包括其子目录)
# First, we configure the "default" to be a very restrictive set of
# features.
#首先,我们定义一个默认的非常严格的配置
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
#
# 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.
#注意,从这一点往前,你必须许可某些特殊的功能,所以如果某些功能未能如你所愿,要确保你在在下述中启用了该功能。
#
# This should be changed to whatever you set DocumentRoot to.
# 这将改变你对DocumentRoot的设置
<Directory "C:/Program Files/Apache Group/Apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
可能的值为None,All或者任意组合
#  Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# 索引包括FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#注意MultiViews被显式地Options All,
# The Options directive is both complicated and important. Please see
#
# 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:
#  Options FileInfo AuthConfig Limit
#AllowOverride 控制什么指令能够加入到.htaccess中,可以是All,None,或者组合关键字
AllowOverride None
#
# Controls who can get stuff from this server.
#控制谁可以可以访问此服务
Order allow,deny
Allow from all
</Directory>
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Be especially careful to use
# proper, forward slashes here. On Windows NT, "Personal/My Website"
# is a more appropriate choice.
# UserDir: 用户的home的名称,当接到到~user的请求时。
请小心正确使用”/”. 在WinNT上,”Personal/My Website”是更合适的选择
UserDir "My Documents/My Website"
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#控制UserDir目录,以下是一个例子,这个目录是只读的
# You must correct the path for the root to match your system's configured
# user directory location, e.g. "C:/WinNT/profiles/*/My Documents/My Website"
# or whichever, as appropriate.
#你必须更正root目录,与系统设置相配,如用户目录是C:/WinNT/profiles/*/My Documents/My Website或者其它合适的
#<Directory "C:/Documents and Settings/*/My Documents/My Website">
#AllowOverride FileInfo AuthConfig Limit
#Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#<Limit GET POST OPTIONS PROPFIND>
#Order allow,deny
#Allow from all
#</Limit>
#<LimitExcept GET POST OPTIONS PROPFIND>
#Order deny,allow
#Deny from all
#</LimitExcept>
#</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#DirectoryIndex: Apache服务器将要以一个目录的形式响应服务
# 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.
#index.html变量文件一种映射)将直接传送内容。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
# directive.
#AccessFileName: 用来查找各个目录下额外的配置指令的配置文件名,同时参考AllowOverride(允许重载)指令
#Acce
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#下面两行,阻址Web客户端访问 .htaccess和htpasswd(访问设定和密码)的文件
#
<Files ~ "^.ht">
Order allow,deny
Deny from all
</Files>
#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
# TypesConfig,描述在何处找到mime型别
TypesConfig 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.
如果服务器不能确定文档的型别,将使用默认的MIME型别,例如根据扩展名
# 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.
#如果你的服务器主要包括text/html文档,”text/plain”就是一个好的取值。如果你的大多数内容是binary(二进制)的,如应用程序或图片,你可能希望使用application/octet-stream,使得浏览器试图显示二进制数据,尽管它们是文本
DefaultType text/plain
#
# 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.
# mod_mime_magic模块,允许服务器根据内容提示来识别文件型别。MIMEMagicFile指令告知模块“内容提示”应到何处找。
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# 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: 客户日志或者仅其IP地址,如www.apache.org(on) 或者204.62.129.132
(off).默认为值设为off比较好,如果希望将此置为on将意味着第一次客户请求都至少要查询一次nameserver.
#
HostnameLookups Off
#
# 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: 控制是否通过内存映射的方式传送文件(须得操作系统支持)
默认值为on; 如果你使用NSF加载的文件系统通常在linux下),应置为off. 在某些系统上,置off,不管使用什么文件系统,能够提高效率,详细情况,请参阅文档
#EnableMMAP off
#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
#
# EnableSendfile: 控制内核传送文件是否支持需要OS支持)。默认为on,如果使用NFS,则使用off
#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: 出错日志文件
如果你想为虚拟主机定义Errorlog指令,则该虚拟主机的错误信息将被记录到这里
ErrorLog logs/error.log
#
# LogLevel: Control the number of messages logged to the error.log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
# LogLever: 日志等级,与log4j相似,译者注),决定哪些级别的出错信息将被记录,如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).
# 日志格式(与log4j相似)
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
# 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
未完待续……

#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:; for detailed information.
# In particular, see
# <URL:;
# for a discussion of each configuration directive.
#
# 这是Apache server的主配置文件. 它包含配置指令,来指示服务器。
# 参考 了解关于指令的详细信息。
# 另外,参看 获取每个配置指令的讨论。

目标,在Linux进行apache2.2版本和tomcat6版本的虚拟主机配置。有些时候apache2.2是不能将请求转发给tomcat的(例如直接处理静态页面的显示),所以我们直接用ajp代理之类的简单策略就没有办法区分动态项目和静态项目处理方式了。在这个方面,tomcat早有准备,推出了tomcat-connectors进行了支持。

  1. Use notepad to open httpd.conf config file. Make use the line "LoadModule rewrite_module modules/mod_rewrite.so" is un-commented.

  2. Under "<directory XXX></directory>" section, change the line "AllowOverride None" to "AllowOverride All".

  3. Change the line "AccessFileName .htaccess" to "AccessFileName htaccess". This is because in Windows, we can't have a file with filename that starts with a dot.

  4. Save the changed file and restart Apache Windows Service. You can then use the file htaccess to process your url rewritting.

Apache 版本: Server version: Apache/2.2.15 

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

# 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.
#
# 不要仅仅是阅读本指令,而应该理解指令做了什么。在这里仅起提示的作用。
# 如果你不清楚请参阅在线文档。特别提示。

  前期安装:

 

总计 1000行左右

# 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').
# 1.控制Apache server的全局操作的指令(全局环境变量)。
#
# 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.
# 2. 配置主服务或者默认服务的指令,它针对那些被虚拟主机以外的请求作出响应。
# 它也包含虚拟主机的一些默认参数。
#
# 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.
# 3. 虚拟主机设置,这使得发往不同的ip或者主机名的请求可以被子同一个Apache服务器处理。

  1、apache已经完全安装到了/usr/local/apache2.2目录下了,web服务端口是80。启动后是apache的it works!提示

#
# This is the main Apache http server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:; for detailed information.
# In particular, see
# <URL:;
# for a discussion of each configuration directive.
#
# 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. 
#
# 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/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# will be interpreted as '/logs/access_log'.
#
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:apache").
# If a drive letter is omitted, the drive on which httpd.exe is located
# will be used by default.  It is recommended that you always supply
# an explicit drive letter in absolute paths to avoid confusion.

英文前带井号的是注释,不起作用。    

# 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 "E:/usr/Apache2.2" will be interpreted by the
# server as "E:/usr/Apache2.2/logs/foo.log".
#
# 配置和日志文件名:如果你所指定的文件名以“/”(在Win32中以“盘符:/”)开头,
# 服务器将以绝对路径来处理。如果文件名不以“/”开头,则以相对路径处理,
# 相对于服务器根(Serverroot)。因此“logs/foo.log”,如果服务器根目录
# 为“E:/usr/Apache2.2”,则服务器解释为“E:/usr/Apache2.2/logs/foo.log”。

  2、tomcat6已经安装到了/usr/local/tomcat6目录下了。8009端口开发,web服务端口是8080。启动后是tomcat的默认页。

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "c:/Apache"

但很多注释去掉前方的  #  即可生效。

#
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:apache").
# 注意:在文件名的定义中,必须用正斜杠,而不是反斜杠。(比如,“c:/apache”,而不是“c:apache”)
#
# If a drive letter is omitted, the drive on which Apache.exe is located
# will be used by default. It is recommended that you always supply
# an explicit drive letter in absolute paths, however, to avoid
# confusion.
# 如果省略了盘符,则以Apache.exe所在的盘符为默认值。建议在绝对路径中明确
# 指定盘符,以避免混乱。

  我在tomcat6的webapps下已经部署了两个jsp项目MicTrader 和MicSeller。通过

#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs

#

# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum number of requests a server process serves
# ThreadsPerChild:每个服务进程中的工作线程常数
# MaxRequestsPerChild:服务进程中允许的最大请求数目
ThreadsPerChild 250
MaxRequestsPerChild 0

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of 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.
#
#Listen 12.34.56.78:80
Listen 8801

# This is the main Apache server configuration file.  It contains the  这是Apache服务器主要配置文件

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
# 指出服务器保存其配置、出错和日志文件等的根目录
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
# 不要在目录的末尾加上斜杠。如果你想将ServerRoot指向非本地硬盘上,请添加卷到本地硬盘上。
# 如果你想共享 ServerRoot 给多个HTTPD镜像服务,你必须改变LockFile和PidFile。
#
ServerRoot "E:/usr/Apache2.2"

  3、jdk已经安装了,并且上边的两个服务已经可用了

#
# 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
#
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule data_module modules/mod_data.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
#LoadModule dumpio_module modules/mod_dumpio.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule filter_module modules/mod_filter.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule lua_module modules/mod_lua.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_html_module modules/mod_proxy_html.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule request_module modules/mod_request.so
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_crypto_module modules/mod_session_crypto.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule xml2enc_module modules/mod_xml2enc.so
LoadModule php5_module "c:/php/php5apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

# configuration directives that give the server its instructions.  它包含影响服务器运行的配置指令

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
# Listen:允许你绑定Apache服务到指定的IP地址和端口上,以取代默认值。请同时参考<VirtualHost>
# 指令。
#
# 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)
# 像下面那样使Apache只在指定的IP地址上监听,以防止它在IP地址0.0.0.0上监听。
#
#Listen 12.34.56.78:80
Listen 8080

  4、linux的RedHat4版本,相关编译包已经ok了

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

# See <URL:; for detailed information. 这里是详细的信息

#
# Dynamic Shared Object (DSO) Support
# 动态共享对象(DSO)支持
#
# 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.
# 为了能够使用那些以DSO模式编译的模块中的函数,你必须放置相应的“LoadModule”行在这里,以便
# 包含在其后的指令在使用之前激活。
# 那些静态编译的模块(即以“httpd -l”列出的模块)则不需要在这里加载。
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so
LoadModule php5_module "E:/usr/php/php5apache2_2.dll"

  下载:

</IfModule>

# In particular, see   尤其是看

# 配置 php.ini 的路径
PHPIniDir "E:/usr/php"

1、connector包:Apache Tomcat Connectors (mod_jk) 1.2.30 for Linux i586

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

# <URL:;

# '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.
#
# 本节中指令的设置值,将被主服务所使用,主服务响应那些没有被<VirtualHost>所处理的请求,
# 这些值也为<VirtualHost>容器提供了默认值,你可以在后面的文件中定义
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
# 所有这些指令将出现在<VirtualHost>容器中,这些设定值将在定义virtual host时被覆写。

命令:wget 

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

# for a discussion of each configuration directive.   每项配置的讨论  

#
# 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: 你的地址,当系统故障时,可以给你发email。
# 此地址出现在那些由服务器生成的页面上,如出错文档。例如:admin@your-domain.com
#
ServerAdmin indian@163.com

注意:

#
# 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 your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName 127.0.0.1

#

#
# 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.
# ServerNaem 定义了server名称和端口号,用以标明自己的身份。
# 通常可以自动定义,建议明确地指定它,避免起动时出错
# If your host doesn't have a registered DNS name, enter its IP address here.
# 如果你没有注册DNS名字,请在这里输入IP地址。
ServerName www.kysf.net:8080

2、下载后的so文件名:mod_jk-1.2.30-httpd-2.2.X.so
将文件拷贝并重命名到:/usr/local/apache2.2/modules/mod_jk.so

#
# 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 />
    AllowOverride none
    Require all denied
</Directory>

#

#
# 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: 你的文档的根目录。默认情况下,所有的请求都从这里开始,
# 但是可以使用符号链接和别名来指向到其他的位置。
#
DocumentRoot "E:/usr/Apache2.2/htdocs"

给文件赋予系统读写权限:cd /usr/local/apache2.2/modules 

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

# Do NOT simply read the instructions in here without understanding 
不要只是简单的阅读这些指令信息而不去理解它

#
# 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).
# 每个可供Apache访问的目录,可以配置成允许和(或)禁止哪些服务和特性(包括其子目录)
#
# First, we configure the "default" to be a very restrictive set of
# features.
# 首先,我们定义一个默认的非常严格的配置
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>

chmod 777 mod_jk.so

#
# 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 "c:/wordpress"
<Directory "c:/wordpress">
    #
    # 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

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

#
# 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没有象你所期待的那样工作的话, 请检查你是否在下面明确的指定它可用。

3、进行相关文件的配置(操作前请备份一份)

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

# consult the online docs. You have been warned. 

#
# This should be changed to whatever you set DocumentRoot to.
# 这将改变你对DocumentRoot的设置
#
<Directory "E:/usr/Apache2.2/htdocs">

(1)、配置httpd.conf。注意内部标注add by kongqz的地方。都是我加上去的。主要是进行了mod_jk.so模块加载,以及虚拟主机的配置两个配置工作

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
    DirectoryIndex index.php
</Directory>

#这里只是做了简单的提示提醒,如果你没有参考在线文件,你就会被警告

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
#Options:这个指令的值可以是“None”,“All”,或者下列选项的任意组合:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

  1. #   
  2. # This is the main Apache HTTP server configuration file.  It contains the   
  3. # configuration directives that give the server its instructions.   
  4. # See <URL:http://httpd.apache.org/docs/2.2> for detailed information.   
  5. # In particular, see    
  6. <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>  
  7. # for a discussion of each configuration directive.   
  8. #   
  9. # Do NOT simply read the instructions in here without understanding   
  10. # what they do.  They're here only as hints or reminders.  If you are unsure   
  11. # consult the online docs. You have been warned.     
  12. #   
  13. # Configuration and logfile names: If the filenames you specify for many   
  14. # of the server's control files begin with "/" (or "drive:/" for Win32), the   
  15. # server will use that explicit path.  If the filenames do *not* begin   
  16. # with "/", the value of ServerRoot is prepended -- so "logs/foo_log"   
  17. # with ServerRoot set to "/usr/local/apache2.2" will be interpreted by the   
  18. # server as "/usr/local/apache2.2/logs/foo_log".   
  19. #   
  20. # ServerRoot: The top of the directory tree under which the server's   
  21. # configuration, error, and log files are kept.   
  22. #   
  23. # Do not add a slash at the end of the directory path.  If you point   
  24. # ServerRoot at a non-local disk, be sure to point the LockFile directive   
  25. # at a local disk.  If you wish to share the same ServerRoot for multiple   
  26. # httpd daemons, you will need to change at least LockFile and PidFile.   
  27. #   
  28. ServerRoot "/usr/local/apache2.2"   
  29. #   
  30. # Listen: Allows you to bind Apache to specific IP addresses and/or   
  31. # ports, instead of the default. See also the <VirtualHost>  
  32. # directive.   
  33. #   
  34. # Change this to Listen on specific IP addresses as shown below to    
  35. # prevent Apache from glomming onto all bound IP addresses.   
  36. #   
  37. #Listen 12.34.56.78:80   
  38. Listen 80   
  39. #   
  40. # Dynamic Shared Object (DSO) Support   
  41. #   
  42. # To be able to use the functionality of a module which was built as a DSO you   
  43. # have to place corresponding `LoadModule' lines at this location so the   
  44. # directives contained in it are actually available _before_ they are used.   
  45. # Statically compiled modules (those listed by `httpd -l') do not need   
  46. # to be loaded here.   
  47. #   
  48. # Example:   
  49. # LoadModule foo_module modules/mod_foo.so   
  50. #   
  51. LoadModule authn_file_module modules/mod_authn_file.so   
  52. LoadModule authn_dbm_module modules/mod_authn_dbm.so   
  53. LoadModule authn_anon_module modules/mod_authn_anon.so   
  54. LoadModule authn_dbd_module modules/mod_authn_dbd.so   
  55. LoadModule authn_default_module modules/mod_authn_default.so   
  56. LoadModule authz_host_module modules/mod_authz_host.so   
  57. LoadModule authz_groupfile_module modules/mod_authz_groupfile.so   
  58. LoadModule authz_user_module modules/mod_authz_user.so   
  59. LoadModule authz_dbm_module modules/mod_authz_dbm.so   
  60. LoadModule authz_owner_module modules/mod_authz_owner.so   
  61. LoadModule authz_default_module modules/mod_authz_default.so   
  62. LoadModule auth_basic_module modules/mod_auth_basic.so   
  63. LoadModule auth_digest_module modules/mod_auth_digest.so   
  64. LoadModule dbd_module modules/mod_dbd.so   
  65. LoadModule dumpio_module modules/mod_dumpio.so   
  66. LoadModule reqtimeout_module modules/mod_reqtimeout.so   
  67. LoadModule ext_filter_module modules/mod_ext_filter.so   
  68. LoadModule include_module modules/mod_include.so   
  69. LoadModule filter_module modules/mod_filter.so   
  70. LoadModule substitute_module modules/mod_substitute.so   
  71. LoadModule deflate_module modules/mod_deflate.so   
  72. LoadModule log_config_module modules/mod_log_config.so   
  73. LoadModule log_forensic_module modules/mod_log_forensic.so   
  74. LoadModule logio_module modules/mod_logio.so   
  75. LoadModule env_module modules/mod_env.so   
  76. LoadModule mime_magic_module modules/mod_mime_magic.so   
  77. LoadModule cern_meta_module modules/mod_cern_meta.so   
  78. LoadModule expires_module modules/mod_expires.so   
  79. LoadModule headers_module modules/mod_headers.so   
  80. LoadModule ident_module modules/mod_ident.so   
  81. LoadModule usertrack_module modules/mod_usertrack.so   
  82. LoadModule unique_id_module modules/mod_unique_id.so   
  83. LoadModule setenvif_module modules/mod_setenvif.so   
  84. LoadModule version_module modules/mod_version.so   
  85. LoadModule proxy_module modules/mod_proxy.so   
  86. LoadModule proxy_connect_module modules/mod_proxy_connect.so   
  87. LoadModule proxy_ftp_module modules/mod_proxy_ftp.so   
  88. LoadModule proxy_http_module modules/mod_proxy_http.so   
  89. LoadModule proxy_scgi_module modules/mod_proxy_scgi.so   
  90. LoadModule proxy_ajp_module modules/mod_proxy_ajp.so   
  91. LoadModule proxy_balancer_module modules/mod_proxy_balancer.so   
  92. LoadModule mime_module modules/mod_mime.so   
  93. LoadModule dav_module modules/mod_dav.so   
  94. LoadModule status_module modules/mod_status.so   
  95. LoadModule autoindex_module modules/mod_autoindex.so   
  96. LoadModule asis_module modules/mod_asis.so   
  97. LoadModule info_module modules/mod_info.so   
  98. LoadModule cgi_module modules/mod_cgi.so   
  99. LoadModule dav_fs_module modules/mod_dav_fs.so   
  100. LoadModule vhost_alias_module modules/mod_vhost_alias.so   
  101. LoadModule negotiation_module modules/mod_negotiation.so   
  102. LoadModule dir_module modules/mod_dir.so   
  103. LoadModule imagemap_module modules/mod_imagemap.so   
  104. LoadModule actions_module modules/mod_actions.so   
  105. LoadModule speling_module modules/mod_speling.so   
  106. LoadModule userdir_module modules/mod_userdir.so   
  107. LoadModule alias_module modules/mod_alias.so   
  108. LoadModule rewrite_module modules/mod_rewrite.so   
  109. #add by kongqz 20101214   
  110. LoadModule jk_module modules/mod_jk.so   
  111. #AddModule mod_jk.c   
  112. Include /usr/local/apache2.2/conf/mod_jk.conf   
  113. <IfModule !mpm_netware_module>  
  114. <IfModule !mpm_winnt_module>  
  115. #   
  116. # If you wish httpd to run as a different user or group, you must run   
  117. # httpd as root initially and it will switch.     
  118. #   
  119. # User/Group: The name (or #number) of the user/group to run httpd as.   
  120. # It is usually good practice to create a dedicated user and group for   
  121. # running httpd, as with most system services.   
  122. #   
  123. User daemon   
  124. Group daemon   
  125. </IfModule>  
  126. </IfModule>  
  127. # 'Main' server configuration   
  128. #   
  129. # The directives in this section set up the values used by the 'main'   
  130. # server, which responds to any requests that aren't handled by a   
  131. <VirtualHost> definition.  These values also provide defaults for   
  132. # any <VirtualHost> containers you may define later in the file.   
  133. #   
  134. # All of these directives may appear inside <VirtualHost> containers,   
  135. # in which case these default settings will be overridden for the   
  136. # virtual host being defined.   
  137. #   
  138. #   
  139. # ServerAdmin: Your address, where problems with the server should be   
  140. # e-mailed.  This address appears on some server-generated pages, such   
  141. # as error documents.  e.g. admin@your-domain.com   
  142. #   
  143. ServerAdmin you@example.com   
  144. #   
  145. # ServerName gives the name and port that the server uses to identify itself.   
  146. # This can often be determined automatically, but we recommend you specify   
  147. # it explicitly to prevent problems during startup.   
  148. #   
  149. # If your host doesn't have a registered DNS name, enter its IP address here.   
  150. #   
  151. #ServerName www.example.com:80   
  152. #   
  153. # DocumentRoot: The directory out of which you will serve your   
  154. # documents. By default, all requests are taken from this directory, but   
  155. # symbolic links and aliases may be used to point to other locations.   
  156. #   
  157. DocumentRoot "/usr/local/apache2.2/htdocs"   
  158. #   
  159. # Each directory to which Apache has access can be configured with respect   
  160. # to which services and features are allowed and/or disabled in that   
  161. # directory (and its subdirectories).    
  162. #   
  163. # First, we configure the "default" to be a very restrictive set of    
  164. # features.     
  165. #   
  166. <Directory />  
  167.     Options FollowSymLinks   
  168.     AllowOverride None   
  169.     Order deny,allow   
  170.     Deny from all   
  171. </Directory>  
  172. #   
  173. # Note that from this point forward you must specifically allow   
  174. # particular features to be enabled - so if something's not working as   
  175. # you might expect, make sure that you have specifically enabled it   
  176. # below.   
  177. #   
  178. #   
  179. # This should be changed to whatever you set DocumentRoot to.   
  180. #   
  181. <Directory "/usr/local/apache2.2/htdocs">  
  182.     #   
  183.     # Possible values for the Options directive are "None", "All",   
  184.     # or any combination of:   
  185.     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews   
  186.     #   
  187.     # Note that "MultiViews" must be named *explicitly* --- "Options All"   
  188.     # doesn't give it to you.   
  189.     #   
  190.     # The Options directive is both complicated and important.  Please see   
  191.     #    
  192.     # for more information.   
  193.     #   
  194.     Options Indexes FollowSymLinks   
  195.     #   
  196.     # AllowOverride controls what directives may be placed in .htaccess files.   
  197.     # It can be "All", "None", or any combination of the keywords:   
  198.     #   Options FileInfo AuthConfig Limit   
  199.     #   
  200.     AllowOverride None   
  201.     #   
  202.     # Controls who can get stuff from this server.   
  203.     #   
  204.     Order allow,deny   
  205.     Allow from all   
  206. </Directory>  
  207. #   
  208. # DirectoryIndex: sets the file that Apache will serve if a directory   
  209. # is requested.   
  210. #   
  211. <IfModule dir_module>  
  212.     DirectoryIndex index.html index.jsp   
  213. </IfModule>  
  214. #   
  215. # The following lines prevent .htaccess and .htpasswd files from being    
  216. # viewed by Web clients.    
  217. #   
  218. <FilesMatch "^.ht">  
  219.     Order allow,deny   
  220.     Deny from all   
  221.     Satisfy All   
  222. </FilesMatch>  
  223. #   
  224. # ErrorLog: The location of the error log file.   
  225. # If you do not specify an ErrorLog directive within a <VirtualHost>  
  226. # container, error messages relating to that virtual host will be   
  227. # logged here.  If you *do* define an error logfile for a <VirtualHost>  
  228. # container, that host's errors will be logged there and not here.   
  229. #   
  230. ErrorLog "logs/error_log"   
  231. #   
  232. # LogLevel: Control the number of messages logged to the error_log.   
  233. # Possible values include: debug, info, notice, warn, error, crit,   
  234. # alert, emerg.   
  235. #   
  236. LogLevel warn   
  237. <IfModule log_config_module>  
  238.     #   
  239.     # The following directives define some format nicknames for use with   
  240.     # a CustomLog directive (see below).   
  241.     #   
  242.     LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined   
  243.     LogFormat "%h %l %u %t "%r" %>s %b" common   
  244.     <IfModule logio_module>  
  245.       # You need to enable mod_logio.c to use %I and %O   
  246.       LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio   
  247.     </IfModule>  
  248.     #   
  249.     # The location and format of the access logfile (Common Logfile Format).   
  250.     # If you do not define any access logfiles within a <VirtualHost>  
  251.     # container, they will be logged here.  Contrariwise, if you *do*   
  252.     # define per-<VirtualHost> access logfiles, transactions will be   
  253.     # logged therein and *not* in this file.   
  254.     #   
  255.     CustomLog "logs/access_log" common   
  256.     #   
  257.     # If you prefer a logfile with access, agent, and referer information   
  258.     # (Combined Logfile Format) you can use the following directive.   
  259.     #   
  260.     #CustomLog "logs/access_log" combined   
  261. </IfModule>  
  262. <IfModule alias_module>  
  263.     #   
  264.     # Redirect: Allows you to tell clients about documents that used to    
  265.     # exist in your server's namespace, but do not anymore. The client    
  266.     # will make a new request for the document at its new location.   
  267.     # Example:   
  268.     # Redirect permanent /foo    
  269.     #   
  270.     # Alias: Maps web paths into filesystem paths and is used to   
  271.     # access content that does not live under the DocumentRoot.   
  272.     # Example:   
  273.     # Alias /webpath /full/filesystem/path   
  274.     #   
  275.     # If you include a trailing / on /webpath then the server will   
  276.     # require it to be present in the URL.  You will also likely   
  277.     # need to provide a <Directory> section to allow access to   
  278.     # the filesystem path.   
  279.     #   
  280.     # ScriptAlias: This controls which directories contain server scripts.    
  281.     # ScriptAliases are essentially the same as Aliases, except that   
  282.     # documents in the target directory are treated as applications and   
  283.     # run by the server when requested rather than as documents sent to the   
  284.     # client.  The same rules about trailing "/" apply to ScriptAlias   
  285.     # directives as to Alias.   
  286.     #   
  287.     ScriptAlias /cgi-bin/ "/usr/local/apache2.2/cgi-bin/"   
  288. </IfModule>  
  289. <IfModule cgid_module>  
  290.     #   
  291.     # ScriptSock: On threaded servers, designate the path to the UNIX   
  292.     # socket used to communicate with the CGI daemon of mod_cgid.   
  293.     #   
  294.     #Scriptsock logs/cgisock   
  295. </IfModule>  
  296. #   
  297. # "/usr/local/apache2.2/cgi-bin" should be changed to whatever your ScriptAliased   
  298. # CGI directory exists, if you have that configured.   
  299. #   
  300. <Directory "/usr/local/apache2.2/cgi-bin">  
  301.     AllowOverride None   
  302.     Options None   
  303.     Order allow,deny   
  304.     Allow from all   
  305. </Directory>  
  306. #   
  307. # DefaultType: the default MIME type the server will use for a document   
  308. # if it cannot otherwise determine one, such as from filename extensions.   
  309. # If your server contains mostly text or HTML documents, "text/plain" is   
  310. # a good value.  If most of your content is binary, such as applications   
  311. # or images, you may want to use "application/octet-stream" instead to   
  312. # keep browsers from trying to display binary files as though they are   
  313. # text.   
  314. #   
  315. DefaultType text/plain   
  316. <IfModule mime_module>  
  317.     #   
  318.     # TypesConfig points to the file containing the list of mappings from   
  319.     # filename extension to MIME-type.   
  320.     #   
  321.     TypesConfig conf/mime.types   
  322.     #   
  323.     # AddType allows you to add to or override the MIME configuration   
  324.     # file specified in TypesConfig for specific file types.   
  325.     #   
  326.     #AddType application/x-gzip .tgz   
  327.     #   
  328.     # AddEncoding allows you to have certain browsers uncompress   
  329.     # information on the fly. Note: Not all browsers support this.   
  330.     #   
  331.     #AddEncoding x-compress .Z   
  332.     #AddEncoding x-gzip .gz .tgz   
  333.     #   
  334.     # If the AddEncoding directives above are commented-out, then you   
  335.     # probably should define those extensions to indicate media types:   
  336.     #   
  337.     AddType application/x-compress .Z   
  338.     AddType application/x-gzip .gz .tgz   
  339.     #   
  340.     # AddHandler allows you to map certain file extensions to "handlers":   
  341.     # actions unrelated to filetype. These can be either built into the server   
  342.     # or added with the Action directive (see below)   
  343.     #   
  344.     # To use CGI scripts outside of ScriptAliased directories:   
  345.     # (You will also need to add "ExecCGI" to the "Options" directive.)   
  346.     #   
  347. 澳门新萄京官方网站:配置文件中文版,conf配置文件。    #AddHandler cgi-script .cgi   
  348.     # For type maps (negotiated resources):   
  349.     #AddHandler type-map var   
  350.     #   
  351.     # Filters allow you to process content before it is sent to the client.   
  352.     #   
  353.     # To parse .shtml files for server-side includes (SSI):   
  354.     # (You will also need to add "Includes" to the "Options" directive.)   
  355.     #   
  356.     #AddType text/html .shtml   
  357.     #AddOutputFilter INCLUDES .shtml   
  358. </IfModule>  
  359. #   
  360. # The mod_mime_magic module allows the server to use various hints from the   
  361. # contents of the file itself to determine its type.  The MIMEMagicFile   
  362. # directive tells the module where the hint definitions are located.   
  363. #   
  364. #MIMEMagicFile conf/magic   
  365. #   
  366. # Customizable error responses come in three flavors:   
  367. # 1) plain text 2) local redirects 3) external redirects   
  368. #   
  369. # Some examples:   
  370. #ErrorDocument 500 "The server made a boo boo."   
  371. #ErrorDocument 404 /missing.html   
  372. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"   
  373. #ErrorDocument 402    
  374. #   
  375. #   
  376. # EnableMMAP and EnableSendfile: On systems that support it,    
  377. # memory-mapping or the sendfile syscall is used to deliver   
  378. # files.  This usually improves server performance, but must   
  379. # be turned off when serving from networked-mounted    
  380. # filesystems or if support for these functions is otherwise   
  381. # broken on your system.   
  382. #   
  383. #EnableMMAP off   
  384. #EnableSendfile off   
  385. # Supplemental configuration   
  386. #   
  387. # The configuration files in the conf/extra/ directory can be    
  388. # included to add extra features or to modify the default configuration of    
  389. # the server, or you may simply copy their contents here and change as    
  390. # necessary.   
  391. # Server-pool management (MPM specific)   
  392. #Include conf/extra/httpd-mpm.conf   
  393. # Multi-language error messages   
  394. #Include conf/extra/httpd-multilang-errordoc.conf   
  395. # Fancy directory listings   
  396. #Include conf/extra/httpd-autoindex.conf   
  397. # Language settings   
  398. #Include conf/extra/httpd-languages.conf   
  399. # User home directories   
  400. #Include conf/extra/httpd-userdir.conf   
  401. # Real-time info on requests and configuration   
  402. #Include conf/extra/httpd-info.conf   
  403. # Virtual hosts   
  404. #Include conf/extra/httpd-vhosts.conf   
  405. # Local access to the Apache HTTP Server Manual   
  406. #Include conf/extra/httpd-manual.conf   
  407. # Distributed authoring and versioning (WebDAV)   
  408. #Include conf/extra/httpd-dav.conf   
  409. # Various default settings   
  410. #Include conf/extra/httpd-default.conf   
  411. #add by kongqz 20101214   
  412. NameVirtualHost *:80   
  413. <VirtualHost *:80>  
  414.     DocumentRoot /usr/local/tomcat6/webapps/MicSeller   
  415.     ServerName seller.linuxidc.com   
  416.     ErrorLog logs/seller-error_log.log   
  417.     CustomLog logs/seller-access_log.log common   
  418.     JkMount /* worker1   
  419. </VirtualHost>  
  420. <VirtualHost *:80>  
  421.     DocumentRoot /usr/local/tomcat6/webapps/MicTrader   
  422.     ServerName trader.linuxidc.com   
  423.     ErrorLog logs/trader-error_log.log   
  424.     CustomLog logs/trader-access_log.log common   
  425.     JkMount /* worker1   
  426. </VirtualHost>  
  427. # Secure (SSL/TLS) connections   
  428. #Include conf/extra/httpd-ssl.conf   
  429. #   
  430. # Note: The following must must be present to support   
  431. #       starting without SSL on platforms with no /dev/random equivalent   
  432. #       but a statically compiled-in mod_ssl.   
  433. #   
  434. <IfModule ssl_module>  
  435. SSLRandomSeed startup builtin   
  436. SSLRandomSeed connect builtin   
  437. </IfModule>  

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

# The configuration directives are grouped into three basic sections:这些配置指令被分为下面三个部分

#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# 注意,“MultiViews”必须被显式的指定,“Options All”不能为你提供这个特性。
#
# The Options directive is both complicated and important. Please see
#
# for more information.
#
# options 指令既复杂又重要,请参见
# 获取更多信息。
#
Options Indexes FollowSymLinks

(2)、增加mod_jk.conf配置文件。这里我将host表中的ip指向服务器,并将域名seller.linuxidc.com和trader.linuxidc.com也一并指向到此服务器

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
    Require all denied
</Files>

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

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

  1. JkWorkersFile /usr/local/apache2.2/conf/workers.properties  
  2. # Where to put jk logs   
  3. JkLogFile /usr/local/apache2.2/logs/mod_jk.log  
  4. # Set the jk log level [debug/error/info]   
  5. JkLogLevel info  
  6. # Select the log format   
  7. JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" 
  8. # JkOptions indicate to send SSL KEY SIZE,    
  9. JkOptions   ForwardKeySize  ForwardURICompat -ForwardDirectories  
  10. # JkRequestLogFormat set the request format    
  11. JkRequestLogFormat "%w %V %T"  
  12. JkMount /servlet/*  worker1   
  13. JkMount /*.jsp worker1   
  14. JkMount /MicSeller/* worker1   
  15. JkMount /MicTrader/* worker1  

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

#     whole (the 'global environment').控制整个Apache服务器行为的部分(即全局环境变量)

#
# Controls who can get stuff from this server.
#
# 控制哪些模块可以获得服务。
#
Order allow,deny
Allow from all

(3)、增加配置文件workers.properties

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

#  2. Directives that define the parameters of the 'main' or 'default' server,定义主要和默认服务指令的参数

</Directory>

  1. # Defining a worker named worker1 and of type ajp13   
  2. worker.list=worker1  
  3. # Set properties for worker1   
  4. worker.worker1.type=ajp13     
  5. worker.worker1.host=localhost     
  6. worker.worker1.port=8009   
  7. worker.worker1.lbfactor=50     
  8. worker.worker1.cachesize=10     
  9. worker.worker1.cache_timeout=600     
  10. worker.worker1.socket_keepalive=1     
  11. worker.worker1.socket_timeout=300  

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

#     which responds to requests that aren't handled by a virtual host.对请求作出响应,并非由一个虚拟主机处理

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# DirectoryIndex: 当请求是一个目录时,Apache向用户提供服务的文件名。(即默认文档名。-译者注。)
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

4、进行访问:

    <IfModule logio_module>
      # 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
    </IfModule>

#     These directives also provide default values for the settings  也为全部虚拟主机提供默认参数

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
# #下面的设置是防止.htaccess和.htpasswd(访问设定和密码)文件被Web客户查看。
#
<FilesMatch "^.ht">
Order allow,deny
Deny from all
</FilesMatch>

配合上边的三个文件的配置,我就可以通过

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

#     of all virtual hosts.

#
# 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,这些错误信息将记录在你所
# 定义的文件里,而不是这里定义的文件。
#
ErrorLog logs/error.log

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

#  3. Settings for virtual hosts, which allow Web requests to be sent to设置虚拟主机,允许web请求发送给不同iIP

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
# LogLevel: 控制记录在错误日志文件中的日志信息数量。
# 可能的值包括: debug, info, notice, warn, error, crit, alert, emerg.
#
LogLevel warn

<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.
    # Example:
    # Redirect permanent /foo

#     different IP addresses or hostnames and have them handled by the或主机名,这些请求的处理通过同一个

<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
# 下面的参数设置是为CustomLog指令定义格式别名(看下面)。
#
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

访问指定的项目了

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

#     same Apache server process.                                                            Apache服务进程。

<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
#
# 你需要安装了mod_logio.c模块才能使用%I和%O
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
</IfModule>

5、如果是静态html文件项目的访问咋办?

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

#

#
# 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.
#
# 指定访问日志文件的位置和格式(一般日志格式)。
# 如果你没有在<VirtualHost>内定义这个指令,处理信息将记录在这里,
# 如果你定义了这个指令,则处理信息记录在你指定的位置,而不是这儿定义的位置。
#
CustomLog logs/access.log common

就在我们的http.conf项目中的配置更改如下:

</IfModule>

# Configuration and logfile names: If the filenames you specify for many配置和日志名称,

#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
# 如果你想要使用一个文件记录access,agent和referer信息(组合日志格式),
# 你可以如下定义这个指令:
#
#CustomLog logs/access.log combined
</IfModule>

<VirtualHost *:80>
    DocumentRoot /usr/local/static
    ServerName static.linuxidc.com
    ErrorLog logs/static-error_log.log
    CustomLog logs/static-access_log.log common
 #   JkMount /* worker1
</VirtualHost>

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

# of the server's control files begin with "/" (or "drive:/" for Win32), the   文件名开头带/使用绝对路径,不带/使用

<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

就是不做转发了,将JkMount 这行去掉

#
# "c:/Apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "c:/Apache/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

# server will use that explicit path.  If the filenames do *not* begin       相对路径,相对于服务器根目录。

#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
#
#Alias: 映射web路径到文件系统路径,通常用于访问不在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 <Directory> section to allow access to
# the filesystem path.
#
# 如果web路径中有后缀“/”,则服务器要求有后缀“/”来描述URL。你也可以用 <Directory> 片段
# 允许访问文件系统路径。

6、如果是我想配合php也一并部署到一个节点上行吗?

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"  举例说明,相对路径文件logs/foo.log 相对

#
# 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: 指定包含服务脚本的目录。
# ScriptAliases本质上与Aliases一样,除了这里的文档在请求时做为程序处理和运行,
# 而不是作为文档发送到客户端。尾部的“/”规则与Alias一样。
#
ScriptAlias /cgi-bin/ "E:/usr/Apache2.2/cgi-bin/"

经过测试,在windows下没有问题。安装完毕php后,直接配置部署php相关模块在httpd.conf中,还是老样子,只要不指定JkMount.请求就不会转发到tomcat。

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

# with ServerRoot set to "/etc/httpd" will be interpreted by the      路径为/etc/httpd,则路径被解释为

</IfModule>

总结:上边我只是配置了java项目的虚拟主机配置方案。更多的时候是为了兼容php或者apache直接进行静态文件的访问。如果只是想在tomcat前放个apache,有更简单的方法,ajp反向代理,直接进行8009端口转发。

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

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

#
# "E:/usr/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
# 更改 "E:/usr/Apache2.2/cgi-bin" 为你的 ScriptAlias(脚本别名)。
#
<Directory "E:/usr/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

澳门新萄京官方网站 1

    # For type maps (negotiated resources):
    #AddHandler type-map var

#

#
# Apache parses all CGI scripts for the shebang line by default.
# This comment line, the first line of the script, consists of the symbols
# pound (#) and exclamation (!) followed by the path of the program that
# can execute this specific script. For a perl script, with perl.exe in
# the C:Program FilesPerl directory, the shebang line should be:
#
# 默认的,Apache 将整个行解释为 CGI 脚本。
# 注释行、脚本第一行、带#!的程序路径,都能执行这个指定的脚本。比如一个 perl 脚本,
# 在 C:Program FilesPerl 中有 perl.exe 解释程序,整个行写为:
#
#!c:/program files/perl/perl

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

 

# Note you _must_not_ indent the actual shebang line, and it must be the
# first line of the file. Of course, CGI processing must be enabled by
# the appropriate ScriptAlias or Options ExecCGI directives for the files
# or directory in question.
#
# However, Apache on Windows allows either the Unix behavior above, or can
# use the Registry to match files by extention. The command to execute
# a file of this type is retrieved from the registry by the same method as
# the Windows Explorer would use to handle double-clicking on a file.
# These script actions can be configured from the Windows Explorer View menu,
# 'Folder Options', and reviewing the 'File Types' tab. Clicking the Edit
# button allows you to modify the Actions, of which Apache 1.3 attempts to
# perform the 'Open' Action, and failing that it will try the shebang line.
# This behavior is subject to change in Apache release 2.0.
#
# Each mechanism has it's own specific security weaknesses, from the means
# to run a program you didn't intend the website owner to invoke, and the
# best method is a matter of great debate.
#
# To enable the this Windows specific behavior (and therefore -disable- the
# equivilant Unix behavior), uncomment the following directive:
#
#ScriptInterpreterSource registry
#
# The directive above can be placed in individual <Directory> blocks or the
# .htaccess file, with either the 'registry' (Windows behavior) or 'script'
# (Unix behavior) option, and will override this server default option.
#

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

### Section 1: Global Environment         第一部分,全局环境

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

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

#

<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types

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

# The directives in this section affect the overall operation of Apache, 这一部分指令会影响整个apache操作

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

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

# such as the number of concurrent requests it can handle or where it 例如Apache能够处理的并发请求的数量

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

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

# can find its configuration files.                                                             或者配置文件地址

# For type maps (negotiated resources):
#AddHandler type-map var

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

#

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

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

 

#添加 .PHP 文件扩展
AddType application/x-httpd-php .php
</IfModule>

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

#

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

# Language settings
#Include conf/extra/httpd-languages.conf

# Don't give away too much information about all the subcomponents 不要泄露太多信息关于正在运行的组件信息

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

# User home directories
#Include conf/extra/httpd-userdir.conf

# we are running.  Comment out this line if you don't mind remote sites  注释掉这一行,如果你不介意远程站点

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is 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.
#
#EnableMMAP off
#EnableSendfile off

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# finding out what major optional modules you are running                    发现你正在运行的其它模块

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

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

ServerTokens OS                                      此指令控制了Server回送给客户端的回应头域是否包含
                                                                   关于服务器OS类型和编译进的模块描信息
                                                                   服务器会发送(比如说):Server: Apache/2.0.41
                                                                   注意:在使用ServerTokens指令时要先启用ServerSignature指令

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

 

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

#

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# ServerRoot: The top of the directory tree under which the server's  ServerRoot服务根目录这个顶级目录树下

# Language settings
#Include conf/extra/httpd-languages.conf

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

# configuration, error, and log files are kept.                                            是服务器配置、错误、日志 文件

# User home directories
#Include conf/extra/httpd-userdir.conf

# 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.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
#
# 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)
#
#<IfModule setenvif_module>
#BrowserMatch "MSIE 10.0;" bad_DNT
#</IfModule>
#<IfModule headers_module>
#RequestHeader unset DNT env=bad_DNT
#</IfModule>

#

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

MaxRequestsPerChild 10

# NOTE!  If you intend to place this on an NFS (or otherwise network)  注意 如果你打算放置上述在NFS或其它网络

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

AccessFileName htaccess

# mounted filesystem then please read the LockFile documentation       位置文件系统,请一定阅读 LockFile 文档

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

 

# (available at <URL:;);

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

Php.ini 基本是原来的:

# you will save yourself a lot of trouble.                                                你自己也会解决很多问题

# Various default settings
#Include conf/extra/httpd-default.conf

[PHP]

#

# 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.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.

# Do NOT add a slash at the end of the directory path.                      不要增加斜线 在目录路径的结尾

您可能感兴趣的文章:

  • Apache配置文件中的deny与allow小结
  • Apache服务器主配置文件httpd.conf详解
  • apache .htaccess文件详解和配置技巧总结
  • 修改apache配置文件去除thinkphp url中的index.php
  • 让Apache支持shtml实现include文件解析的配置方法
  • apache 配置文件解说
  • Apache服务的主要目录和配置文件详解

; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
; 1. SAPI module specific location.
; 2. The PHPRC environment variable. (As of PHP 5.2.0)
; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)
; 4. Current working directory (except CLI)
; 5. The web server's directory (for SAPI modules), or directory of PHP
; (otherwise in Windows)
; 6. The directory from the --with-config-file-path compile time option, or the
; Windows directory (C:windows or C:winnt)
; See the PHP docs for more specific information.
;

#

; The syntax of the file is extremely simple.  Whitespace and lines
; beginning with a semicolon are silently ignored (as you probably guessed).
; Section headers (e.g. [Foo]) are also silently ignored, even though
; they might mean something in the future.

ServerRoot "/etc/httpd"                                                                   ServerRoot 服务器根目录……

; Directives following the section heading [PATH=/www/mysite] only
; apply to PHP files in the /www/mysite directory.  Directives
; following the section heading [HOST=www.example.com] only apply to
; PHP files served from www.example.com.  Directives set in these
; special sections cannot be overridden by user-defined INI files or
; at runtime. Currently, [PATH=] and [HOST=] sections only work under
; CGI/FastCGI.
;

 

; Directives are specified using the following syntax:
; directive = value
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
; Directives are variables used to configure PHP or PHP extensions.
; There is no name validation.  If PHP can't find an expected
; directive because it is not set or is mistyped, a default value will be used.

#

; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a
; previously set variable or directive (e.g. ${foo})

# PidFile: The file in which the server should record its process  Pid文件: 服务器记录启动时进程号的文件

; Expressions in the INI file are limited to bitwise operators and parentheses:
; |  bitwise OR
; ^  bitwise XOR
; &  bitwise AND
; ~  bitwise NOT
; !  boolean NOT

# identification number when it starts.  Note the PIDFILE variable in     注意 如果文件位置改变 文件变量必须在……

; Boolean flags can be turned on using the values 1, On, True or Yes.
; They can be turned off using the values 0, Off, False or No.

# /etc/sysconfig/httpd must be set appropriately if this location is        设置好

; An empty string can be denoted by simply not writing anything after the equal
; sign, or by using the None keyword:

# changed.

;  foo =         ; sets foo to an empty string
;  foo = None    ; sets foo to an empty string
;  foo = "None"  ; sets foo to the string 'None'

#                                                                                                          apache进程的进程号文件存放位置

; If you use constants in your value, and these constants belong to a
; dynamically loaded extension (either a PHP extension or a Zend extension),
; you may only use these constants *after* the line that loads the extension.

PidFile run/httpd.pid          

;;;;;;;;;;;;;;;;;;;
; About this file ;
;;;;;;;;;;;;;;;;;;;
; PHP comes packaged with two INI files. One that is recommended to be used
; in production environments and one that is recommended to be used in
; development environments.

 

; php.ini-production contains settings which hold security, performance and
; best practices at its core. But please be aware, these settings may break
; compatibility with older or less security conscience applications. We
; recommending using the production ini in production and testing environments.

#

; php.ini-development is very similar to its production variant, except it's
; much more verbose when it comes to errors. We recommending using the
; development version only in development environments as errors shown to
; application users can inadvertently leak otherwise secure information.

# Timeout: The number of seconds before receives and sends time out.       接收和发生超时信息的时间(秒)

;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.

#

; display_errors
;   Default Value: On
;   Development Value: On
;   Production Value: Off

Timeout 60

; display_startup_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

 

; error_reporting
;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;   Development Value: E_ALL
;   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

#

; html_errors
;   Default Value: On
;   Development Value: On
;   Production value: On

# KeepAlive: Whether or not to allow persistent connections (more than  是否允许保持连接(On 则每个连接可以传递多个请求)

; log_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: On

# one request per connection). Set to "Off" to deactivate.    设置off为 无效 停用(则一次连接能响应一个请求,而一个请求一般只传输一个文件)

; max_input_time
;   Default Value: -1 (Unlimited)
;   Development Value: 60 (60 seconds)
;   Production Value: 60 (60 seconds)

#                               (若一个页面有多个文件,设置为On可明显提高响应速度)

; output_buffering
;   Default Value: Off
;   Development Value: 4096
;   Production Value: 4096

KeepAlive Off

; register_argc_argv
;   Default Value: On
;   Development Value: Off
;   Production Value: Off

 

; request_order
;   Default Value: None
;   Development Value: "GP"
;   Production Value: "GP"

#

; session.bug_compat_42
;   Default Value: On
;   Development Value: On
;   Production Value: Off

# MaxKeepAliveRequests: The maximum number of requests to allow 最大请求数一次连接期间允许的最大请求数

; session.bug_compat_warn
;   Default Value: On
;   Development Value: On
;   Production Value: Off

# during a persistent connection. Set to 0 to allow an unlimited amount.  设置为0 则不限制数量

; session.gc_divisor
;   Default Value: 100
;   Development Value: 1000
;   Production Value: 1000

# We recommend you leave this number high, for maximum performance. 我们推荐你设置较高的数 为了更好性能

; session.hash_bits_per_character
;   Default Value: 4
;   Development Value: 5
;   Production Value: 5

#

; short_open_tag
;   Default Value: On
;   Development Value: Off
;   Production Value: Off

MaxKeepAliveRequests 100

; track_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

 

; url_rewriter.tags
;   Default Value: "a=href,area=href,frame=src,form=,fieldset="
;   Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
;   Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"

#

; variables_order
;   Default Value: "EGPCS"
;   Development Value: "GPCS"
;   Production Value: "GPCS"

# KeepAliveTimeout: Number of seconds to wait for the next request from the 同一连接 等待下次请求 秒数

;;;;;;;;;;;;;;;;;;;;
; php.ini Options  ;
;;;;;;;;;;;;;;;;;;;;
; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini"
;user_ini.filename = ".user.ini"

# same client on the same connection.                                                             来自同一用户

; To disable this feature set this option to empty value
;user_ini.filename =

#                                                                                              (KeepAlive 的超时时间为 15 秒种)

; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes)
;user_ini.cache_ttl = 300

KeepAliveTimeout 15

;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;

 

; Enable the PHP scripting language engine under Apache.
;
engine = On

##

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
;
short_open_tag = Off

## Server-Pool Size Regulation (MPM specific)                           服务器-池  大小规则 (针对MPM)

; Allow ASP-style <% %> tags.
;
asp_tags = Off

##                                                                                           MPM:Multi-Processing Module 多路处理模块

; The number of significant digits displayed in floating point numbers.
;
precision = 14

                                                                                               这里MPM有两种模式  prefork模式   worker模式

; Output buffering is a mechanism for controlling how much output data
; (excluding headers and cookies) PHP should keep internally before pushing that
; data to the client. If your application's output exceeds this setting, PHP
; will send that data in chunks of roughly the size you specify.
; Turning on this setting and managing its maximum buffer size can yield some
; interesting side-effects depending on your application and web server.
; You may be able to send headers and cookies after you've already sent output
; through print or echo. You also may see performance benefits if your server is
; emitting less packets due to buffered output versus PHP streaming the output
; as it gets it. On production servers, 4096 bytes is a good setting for performance
; reasons.
; Note: Output buffering can also be controlled via Output Buffering Control
;   functions.
; Possible Values:
;   On = Enabled and buffer is unlimited. (Use with caution)
;   Off = Disabled
;   Integer = Enables the buffer and sets its maximum size in bytes.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: Off
; Development Value: 4096
; Production Value: 4096
;
output_buffering = 4096

提前说明 选择使用哪种mpm模块,需要在安装apache时指定,例如:

; You can redirect all of the output of your scripts to a function.  For
; example, if you set output_handler to "mb_output_handler", character
; encoding will be transparently converted to the specified encoding.
; Setting any output handler automatically turns on output buffering.
; Note: People who wrote portable scripts should not depend on this ini
;   directive. Instead, explicitly set the output handler using ob_start().
;   Using this ini directive may cause problems unless you know what script
;   is doing.
; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler"
;   and you cannot use both "ob_gzhandler" and "zlib.output_compression".
; Note: output_handler must be empty if this is set 'On' !!!!
;   Instead you must use zlib.output_handler.
;
;output_handler =

在Apache 2.0中如何指定MPM。
#tar -xvzf httpd-2.0.59.tar.gz
#cd httpd-2.0.59
#./configure --help|grep mpm
--with-mpm=MPM Choose the process model for Apache to use.
MPM={beos|worker|prefork|mpmt_os2|perchild|leader|threadpool}
上述操作用来选择要使用的进程模型,即哪种MPM模块

; Transparent output compression using the zlib library
; Valid values for this option are 'off', 'on', or a specific buffer size
; to be used for compression (default is 4KB)
; Note: Resulting chunk size may vary due to nature of compression. PHP
;   outputs chunks that are few hundreds bytes each as a result of
;   compression. If you prefer a larger chunk size for better
;   performance, enable output_buffering in addition.
; Note: You need to use zlib.output_handler instead of the standard
;   output_handler, or otherwise the output will be corrupted.
;
zlib.output_compression = Off

    如果不用“--with-mpm”显式指定某种MPM,prefork就是Unix平台上缺省的MPM。它所采用的预派生子进程方式也是Apache 1.3中采用的模式。prefork本身并没有使用到线程,2.0版使用它是为了与1.3版保持兼容性;另一方面,prefork用单独的子进程来处理不同的请求,进程之间是彼此独立的,这也使其成为最稳定的MPM之一。  

;
;zlib.output_compression_level = -1

 我以worker模式进行编译安装 
  # ./configure --prefix=/opt/apache --with-mpm=worker --enable-module=so  

; You cannot specify additional output handlers if zlib.output_compression
; is activated here. This setting does the same as output_handler but in
; a different order.
;
;zlib.output_handler =

安装完成后,可以使用 httpd -l  来查看使用的哪种mpm 
     [root@localhost ~]# httpd -l

; Implicit flush tells PHP to tell the output layer to flush itself
; automatically after every output block.  This is equivalent to calling the
; PHP function flush() after each and every call to print() or echo() and each
; and every HTML block.  Turning this option on has serious performance
; implications and is generally recommended for debugging purposes only.
;
; Note: This directive is hardcoded to On for the CLI SAPI
implicit_flush = Off

Compiled in modules:

; The unserialize callback function will be called (with the undefined class'
; name as parameter), if the unserializer finds an undefined class
; which should be instantiated. A warning appears if the specified function is
; not defined, or if the function doesn't include/implement the missing class.
; So only set this entry, if you really want to implement such a
; callback-function.
unserialize_callback_func =

  core.c

; When floats & doubles are serialized store serialize_precision significant
; digits after the floating point. The default value ensures that when floats
; are decoded with unserialize, the data will remain the same.
serialize_precision = 17

  prefork.c

; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;
;open_basedir =

  http_core.c

; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;
disable_functions =

  mod_so.c

; This directive allows you to disable certain classes for security reasons.
; It receives a comma-delimited list of class names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;
disable_classes =

prefork模式:欲派生,多进程

; Colors for Syntax Highlighting mode.  Anything that's acceptable in
; <span > would work.
;
;highlight.string  = #DD0000
;highlight.comment = #FF9900
;highlight.keyword = #007700
;highlight.default = #0000BB
;highlight.html    = #000000

         一个单独的控制进程(父进程)负责产生子进程,这些子进程用于监听请求并作出应答。Apache总是试图保持一些备用的(spare)或者是空闲的子进程用于迎接即将到来的请求。这样客户端就不需要在得到服务前等候子进程的产生。        这个多路处理模块(MPM)实现了一个非线程型的、预派生的web服务器 。
**
       欲派生模式 prefork是Unix平台上的默认(缺省)MPM,使用多个子进程,每个子进程只有一个线程。每个进程在某个确定的时间只能维持一个连接,效率高,但内存占用量比较大**。 

; If enabled, the request will be allowed to complete even if the user aborts
; the request. Consider enabling it if executing long requests, which may end up
; being interrupted by the user or a browser timing out. PHP's default behavior
; is to disable this feature.
;
;ignore_user_abort = On

    这个多路处理模块(MPM)实现了一个非线程型的、预派生的web服务器,它的工作方式类似于Apache 1.3。它适合于没有线程安全库,需要避免线程兼容性问题的系统。它是要求将每个请求相互独立的情况下最好的MPM,这样若一个请求出现问题就不会影响到其他请求。

; Determines the size of the realpath cache to be used by PHP. This value should
; be increased on systems where PHP opens many files to reflect the quantity of
; the file operations performed.
;
;realpath_cache_size = 16k

      prefork的工作原理是,控制进程在最初建立“StartServers”个子进程后,为了满足MinSpareServers设置的需要创建一个进程,等待一秒钟,继续创建两个,再等待一秒钟,继续创建四个……如此按指数级增加创建的进程数,最多达到每秒32个,直到满足MinSpareServers设置的值为止。这就是预派生(prefork)的由来。这种模式可以不必在请求到来时再产生新的进程,从而减小了系统开销以增加性能。
    MaxSpareServers设置了最大的空闲进程数,如果空闲进程数大于这个值,Apache会自动kill掉一些多余进程。这个值不要设得过大,但如果设的值比MinSpareServers小,Apache会自动把其调整为MinSpareServers 1。如果站点负载较大,可考虑同时加大MinSpareServers和MaxSpareServers。 
    MaxRequestsPerChild设置的是每个子进程可处理的请求数。每个子进程在处理了“MaxRequestsPerChild”个请求后将自动销毁。0意味着无限,即子进程永不销毁。虽然缺省设为0可以使每个子进程处理更多的请求。
    但如果设成非零值也有两点重要的好处: 
     ◆ 可防止意外的内存泄漏; 
     ◆ 在服务器负载下降的时侯会自动减少子进程数。 
    
    因此,可根据服务器的负载来调整这个值。笔者认为10000左右比较合适。
    MaxClients是这些指令中最为重要的一个,设定的是Apache可以同时处理的请求,是对Apache性能影响最大的参数。其缺省值150是远远不够的,如果请求总数已达到这个值(可通过 ps -ef|grep http|wc -l 来确认),那么后面的请求就要排队,直到某个已处理请求完毕。这就是系统资源还剩下很多而HTTP访问却很慢的主要原因。系统管理员可以根据硬件配置和负载情况来动态调整这个值。虽然理论上这个值越大,可以处理的请求就越多,但Apache默认的限制不能大于256。如果把这个值设为大于256,那么Apache将无法起动。事实上,256对于负载稍重的站点也是不够的。在Apache 1.3中,这是个硬限制。如果要加大这个值,必须在“configure”前手工修改的源代码树下的src/include/httpd.h中查找256,就会发现“#define HARD_SERVER_LIMIT 256”这行。把256改为要增大的值(如4000),然后重新编译Apache即可。在Apache 2.0中新加入了ServerLimit指令,使得无须重编译Apache就可以加大MaxClients。

; Duration of time, in seconds for which to cache realpath information for a given
; file or directory. For systems with rarely changing files, consider increasing this
; value.
;
;realpath_cache_ttl = 120

# prefork MPM                                预创建(欲派生) MPM

; Enables or disables the circular reference collector.
;
zend.enable_gc = On

# StartServers: number of server processes to start        启动时服务器启动的进程数 

; If enabled, scripts may be written in encodings that are incompatible with
; the scanner.  CP936, Big5, CP949 and Shift_JIS are the examples of such
; encodings.  To use this feature, mbstring extension must be enabled.
; Default: Off
;zend.multibyte = Off

# MinSpareServers: minimum number of server processes which are kept spare    保存备用的最小服务进程数(最小空闲子进程数)
       所谓空闲子进程是指没有正在处理请求的子进程,
      如果你将该指令的值设置为比MinSpareServers小,Apache将会自动将其修改成"MinSpareServers`` 1

; Allows to set the default encoding for the scripts.  This value will be used
; unless "declare(encoding=...)" directive appears at the top of the script.
; Only affects if zend.multibyte is set.
; Default: ""
;zend.script_encoding =

# MaxSpareServers: maximum number of server processes which are kept spare 保存备用的最大服务进程数(最大空闲子进程数)
           如果当前有超过MaxSpareServers数量的空闲子进程,那么父进程将杀死多余的子进程

;;;;;;;;;;;;;;;;;
; Miscellaneous ;
;;;;;;;;;;;;;;;;;

# ServerLimit: maximum value for MaxClients for the lifetime of the server   apache子进程最多个数;参见*下方注释

; Decides whether PHP may expose the fact that it is installed on the server
; (e.g. by adding its signature to the Web server header).  It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
;
expose_php = On

# MaxClients: maximum number of server processes allowed to start         服务器允许启动的最大请求并发数(同时响应客户数)

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

# MaxRequestsPerChild: maximum number of requests a server process serves   * 一个服务子进程允许的最大请求数

; Maximum execution time of each script, in seconds
;
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30

<IfModule prefork.c>                                                                                           (到达限制就释放重新建立)

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
;
max_input_time = 60

StartServers       8     apache开始运行时,立刻启动8个服务器子进程

; Maximum input variable nesting level
;
;max_input_nesting_level = 64

MinSpareServers    5

; How many GET/POST/COOKIE input variables may be accepted
; max_input_vars = 1000

MaxSpareServers   20

; Maximum amount of memory a script may consume (128MB)
;
memory_limit = 128M

ServerLimit      256     *MaxClients最大为256,其若继续增大则要加上ServerLimit这个参数,生效前提:必须放在其                                     它指令的前面,对于preforkMPM,只有在你需要将MaxClients设置成高于默认值256的时候才需要使用这个指令。要将此指令的值保持和MaxClients一样。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

MaxClients       256    最大子进程数量,默认为256。任何超过MaxClients限制的请求都将进入等候队列,一                                  旦一个链接被释放,队列中的请求将得到服务。要增大这个值,你必须同时增大ServerLimit

; This directive informs PHP of which errors, warnings and notices you would like
; it to take action for. The recommended way of setting values for this
; directive is through the use of the error level constants and bitwise
; operators. The error level constants are below here for convenience as well as
; some common settings and their meanings.
; By default, PHP is set to take action on all errors, notices and warnings EXCEPT
; those related to E_NOTICE and E_STRICT, which together cover best practices and
; recommended coding standards in PHP. For performance reasons, this is the
; recommend error reporting setting. Your production server shouldn't be wasting
; resources complaining about best practices and coding standards. That's what
; development servers and development settings are for.
; Note: The php.ini-development file has this setting as E_ALL. This
; means it pretty much reports everything which is exactly what you want during
; development and early testing.
;
; Error Level Constants:
; E_ALL             - All errors and warnings (includes E_STRICT as of PHP 5.4.0)
; E_ERROR           - fatal run-time errors
; E_RECOVERABLE_ERROR  - almost fatal run-time errors
; E_WARNING         - run-time warnings (non-fatal errors)
; E_PARSE           - compile-time parse errors
; E_NOTICE          - run-time notices (these are warnings which often result
;                     from a bug in your code, but it's possible that it was
;                     intentional (e.g., using an uninitialized variable and
;                     relying on the fact it's automatically initialized to an
;                     empty string)
; E_STRICT          - run-time notices, enable to have PHP suggest changes
;                     to your code which will ensure the best interoperability
;                     and forward compatibility of your code
; E_CORE_ERROR      - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING    - warnings (non-fatal errors) that occur during PHP's
;                     initial startup
; E_COMPILE_ERROR   - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR      - user-generated error message
; E_USER_WARNING    - user-generated warning message
; E_USER_NOTICE     - user-generated notice message
; E_DEPRECATED      - warn about code that will not work in future versions
;                     of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
;
; Common Values:
;   E_ALL (Show all errors, warnings and notices including coding standards.)
;   E_ALL & ~E_NOTICE  (Show all errors, except for notices)
;   E_ALL & ~E_NOTICE & ~E_STRICT  (Show all errors, except for notices and coding standards warnings.)
;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
;
error_reporting = E_ALL

MaxRequestsPerChild  4000    *每个子进程在其生存期内允许伺服的最大请求数量到达MaxRequestsPerChild的限制后,子进程将会结束。如果 MaxRequestsPerChild为"0",子进程将永远不会结束。将MaxRequestsPerChild设置成非零值有两个好处:

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; It's recommended that errors be logged on production servers rather than
; having the errors sent to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
;
display_errors = On

1. 可以防止(偶然的)内存泄漏无限进行,从而耗尽内存。
2. 给进程一个有限寿命,从而有助于当服务器负载减轻的时候减少活动进程的数量。

; The display of errors which occur during PHP's startup sequence are handled
; separately from display_errors. PHP's default behavior is to suppress those
; errors from clients. Turning the display of startup errors on can be useful in
; debugging configuration problems. But, it's strongly recommended that you
; leave this setting off on production servers.
; Default Value: Off
; Development Value: On
; Production Value: Off
;
display_startup_errors = On

</IfModule>

; Besides displaying errors, PHP can also log errors to locations such as a
; server-specific log, STDERR, or a location specified by the error_log
; directive found below. While errors should not be displayed on productions
; servers they should still be monitored and logging is a great way to do that.
; Default Value: Off
; Development Value: On
; Production Value: On
;
log_errors = On

 

; Set maximum length of log_errors. In error_log information about the source is
; added. The default is 1024 and 0 allows to not apply any maximum length at all.
;
log_errors_max_len = 1024

worker模式:欲派生,多线程

; Do not log repeated messages. Repeated errors must occur in same file on same
; line unless ignore_repeated_source is set true.
;
ignore_repeated_errors = Off

       此多路处理模块(MPM)使网络服务器支持混合的多线程多进程。由于使用线程来处理请求,所以可以处理海量请求,而系统资源的开销小于基于进程的MPM。但是,它也使用了多进程,每个进程又有多个线程,以获得基于进程的MPM的稳定性。         worker使用多个子进程,每个子进程有多个线程,每个线程在某个确定的时间只能维持一个连接,内存占用量比较小,适合高流量的http服务器。缺点是假如一个线程崩溃,整个进程就会连同其任何线程一起”死掉”,所以要保证一个程式在运行时必须被系统识别为”每个线程都是安全的”。 
      可以处理海量请求,而系统资源的开销小于基于进程的MPM。但是它也使用了多进程,每个进程又有多个线程,以获得基于进程的MPM的稳定性。

; Ignore source of message when ignoring repeated messages. When this setting
; is On you will not log errors with repeated messages from different files or
; source lines.
;
ignore_repeated_source = Off

       worker是2.0 版中全新的支持多线程和多进程混合模型的MPM。由于使用线程来处理,所以可以处理相对海量的请求,而系统资源的开销要小于基于进程的服务器。但是,worker也使用了多进程,每个进程又生成多个线程,以获得基于进程服务器的稳定性。这种MPM的工作方式将是Apache 2.0的发展趋势。 

; If this parameter is set to Off, then memory leaks will not be shown (on
; stdout or in the log). This has only effect in a debug compile, and if
; error reporting includes E_WARNING in the allowed list
;
report_memleaks = On

# worker MPM                                 worker 模式 MPM  

; This setting is on by default.
;report_zend_debug = 0

# StartServers: initial number of server processes to start                       服务器启动时建立的初始子进程数  每个子进程中包含固                                                                              定的ThreadsPerChild线程数,各个线程独立地处理请求

; Store the last error/warning message in $php_errormsg (boolean). Setting this value
; to On can assist in debugging and is appropriate for development servers. It should
; however be disabled on production servers.
; Default Value: Off
; Development Value: On
; Production Value: Off
;
track_errors = On

# MaxClients: maximum number of simultaneous client connections          同时连接的最大用户数目 MaxClients设置了所有子进程中的线程总数

; Turn off normal error reporting and emit XML-RPC error XML
;
;xmlrpc_errors = 0

# MinSpareThreads: minimum number of worker threads which are kept spare     保有的最小空闲工作线程数

; An XML-RPC faultCode
;xmlrpc_error_number = 0

         这个MPM将基于整个服务器监视空闲线程数。如果服务器中总的空闲线程数太少,子进程将产生新的空闲线程。

; When PHP displays or logs an error, it has the capability of formatting the
; error message as HTML for easier reading. This directive controls whether
; the error message is formatted as HTML or not.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: On
; Development Value: On
; Production value: On
;
html_errors = On

# MaxSpareThreads: maximum number of worker threads which are kept spare   保有的最大空闲工作线程数
           这个MPM将基于整个服务器监视空闲线程数。如果服务器中总的空闲线程数太多,子进程将杀死多余的空闲线程。

; If html_errors is set to On *and* docref_root is not empty, then PHP
; produces clickable error messages that direct to a page describing the error
; or function causing the error in detail.
; You can download a copy of the PHP manual from
; and change docref_root to the base URL of your local copy including the
; leading '/'. You must also specify the file extension being used including
; the dot. PHP's default behavior is to leave these settings empty, in which
; case no links to documentation are generated.
; Note: Never use this feature for production boxes.
;
; Examples
;docref_root = "/phpmanual/"

            Apache总是试图维持一个备用(spare)或是空闲的服务线程池。这样,客户端无须等待新线程或新进程的建立即可得到处理。初始化时         建立的进程数量由StartServers指令决定。随后父进程检测所有子进程中空闲线程的总数,并新建或结束子进程使空闲线程的总数维             持在MinSpareThreadsMaxSpareThreads所指定的范围内。由于这个过程是自动调整的,几乎没有必要修改这些指令的缺省值。可以         并行处理的客户端的最大数量取决于MaxClients指令。活动子进程的最大数量取决于MaxClients除以ThreadsPerChild的值

;
;docref_ext = .html

# ThreadsPerChild: constant number of worker threads in each server process     *每个服务进程中的工作线程常数 

; String to output before an error message. PHP's default behavior is to leave
; this setting blank.
;
; Example:
;error_prepend_string = "<span >"

# MaxRequestsPerChild: maximum number of requests a server process serves    服务进程中允许的最大请求数目

; String to output after an error message. PHP's default behavior is to leave
; this setting blank.
;
; Example:
;error_append_string = "</span>"

-

; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
;
; Example:
;error_log = php_errors.log
; Log errors to syslog (Event Log on NT, not valid in Windows 95).
;error_log = syslog

<IfModule worker.c>

;windows.show_crt_warning
; Default value: 0
; Development value: 0
; Production value: 0

StartServers         4        

;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;

MaxClients         300

; The separator used in PHP generated URLs to separate arguments.
; PHP's default setting is "&".
;
; Example:
;arg_separator.output = "&"

MinSpareThreads     25

; List of separator(s) used by PHP to parse input URLs into variables.
; PHP's default setting is "&".
; NOTE: Every character in this directive is considered as separator!
;
; Example:
;arg_separator.input = ";&"

MaxSpareThreads     75

; This directive determines which super global arrays are registered when PHP
; starts up. G,P,C,E & S are abbreviations for the following respective super
; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty
; paid for the registration of these arrays and because ENV is not as commonly
; used as the others, ENV is not recommended on productions servers. You
; can still get access to the environment variables through getenv() should you
; need to.
; Default Value: "EGPCS"
; Development Value: "GPCS"
; Production Value: "GPCS";
;
variables_order = "GPCS"

ThreadsPerChild     25  每个子进程建立的常驻的执行线程数,默认值25子进程在启动时建立这些线程后就不再建立新的线程

; This directive determines which super global data (G,P,C,E & S) should
; be registered into the super global array REQUEST. If so, it also determines
; the order in which that data is registered. The values for this directive are
; specified in the same manner as the variables_order directive, EXCEPT one.
; Leaving this value empty will cause PHP to use the value set in the
; variables_order directive. It does not mean it will leave the super globals
; array REQUEST empty.
; Default Value: None
; Development Value: "GP"
; Production Value: "GP"
;
request_order = "GP"

MaxRequestsPerChild  0     每个子进程在其生存期内允许伺服的最大请求数量。到达MaxRequestsPerChild的限制后, 

; This directive determines whether PHP registers $argv & $argc each time it
; runs. $argv contains an array of all the arguments passed to PHP when a script
; is invoked. $argc contains an integer representing the number of arguments
; that were passed when the script was invoked. These arrays are extremely
; useful when running scripts from the command line. When this directive is
; enabled, registering these variables consumes CPU cycles and memory each time
; a script is executed. For performance reasons, this feature should be disabled
; on production servers.
; Note: This directive is hardcoded to On for the CLI SAPI
; Default Value: On
; Development Value: Off
; Production Value: Off
;
register_argc_argv = Off

</IfModule>                       子进程将会结束。如果MaxRequestsPerChild为"0",子进程将永远不会结束             

; When enabled, the ENV, REQUEST and SERVER variables are created when they're
; first used (Just In Time) instead of when the script starts. If these
; variables are not used within a script, having this directive on will result
; in a performance gain. The PHP directive register_argc_argv must be disabled
; for this directive to have any affect.
;
auto_globals_jit = On

    MinSpareThreads和MaxSpareThreads的最大缺省值分别是75和250。这两个参数对Apache的性能影响并不大,可以按照实际情况相应调节。 
    ThreadsPerChild是worker MPM中与性能相关最密切的指令。ThreadsPerChild的最大缺省值是64,如果负载较大,64也是不够的。这时要显式使用ThreadLimit指令,它的最大缺省值是20000。上述两个值位于源码树server/mpm/worker/worker.c中的以下两行: 

; Whether PHP will read the POST data.
; This option is enabled by default.
; Most likely, you won't want to disable this option globally. It causes $_POST
; and $_FILES to always be empty; the only way you will be able to read the
; POST data will be through the php://input stream wrapper. This can be useful
; to proxy requests or to process the POST data in a memory efficient fashion.
;
;enable_post_data_reading = Off

#define DEFAULT_THREAD_LIMIT 64 
#define MAX_THREAD_LIMIT 20000 
    这两行对应着ThreadsPerChild和ThreadLimit的限制数。最好在configure之前就把64改成所希望的值。注意,不要把这两个值设得太高,超过系统的处理能力,从而因Apache不起动使系统很不稳定。
    Worker模式下所能同时处理的请求总数是由子进程总数乘以ThreadsPerChild值决定的,应该大于等于MaxClients。如果负载很大,现有的子进程数不能满足时,控制进程会派生新的子进程。默认最大的子进程总数是16,加大时也需要显式声明ServerLimit(最大值是20000)。这两个值位于源码树server/mpm/worker/worker.c中的以下两行: 

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
;
post_max_size = 8M

#define DEFAULT_SERVER_LIMIT 16 
#define MAX_SERVER_LIMIT 20000 

; Automatically add files before PHP document.
;
auto_prepend_file =

    需要注意的是,如果显式声明了ServerLimit,那么它乘以ThreadsPerChild的值必须大于等于MaxClients,而且MaxClients必须是ThreadsPerChild的整数倍,否则Apache将会自动调节到一个相应值(可能是个非期望值)

; Automatically add files after PHP document.
;
auto_append_file =

 

; By default, PHP will output a character encoding using
; the Content-type: header.  To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
;
default_mimetype = "text/html"

#

; PHP's default character set is set to empty.
;
;default_charset = "UTF-8"

# Listen: Allows you to bind Apache to specific IP addresses and/or  允许你绑定特定的IP地址或者端口  以取代默认值

; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is
; to disable this feature. If post reading is disabled through
; enable_post_data_reading, $HTTP_RAW_POST_DATA is *NOT* populated.
;
;always_populate_raw_post_data = On

# ports, in addition to the default. See also the <VirtualHost>           可以参考……指令

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

# directive.

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "path1;path2"
;include_path = ".;c:phpincludes"
;
; PHP's default setting for include_path is ".;/path/to/php/pear"
;

#

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
;
doc_root =

# Change this to Listen on specific IP addresses as shown below to    用特定的IP改变监听端口  如下所示 防止Apache绑定0.0.0.0 IP

; The directory under which PHP opens the script using /~username used only
; if nonempty.
;
user_dir =

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

; Directory in which the loadable extensions (modules) reside.
;
; extension_dir = "./"
; On windows:
; extension_dir = "ext"

#

; Whether or not to enable the dl() function.  The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
;
enable_dl = Off

#Listen 12.34.56.78:80                                                           例如:绑定监听IP 为12.34.56.78    端口 80 

; cgi.force_redirect is necessary to provide security running PHP as a CGI under
; most web servers.  Left undefined, PHP turns this on by default.  You can
; turn it off here AT YOUR OWN RISK
; **You CAN safely turn this off for IIS, in fact, you MUST.**
;
;cgi.force_redirect = 1

Listen 80                                                                                   监听端口:80

; if cgi.nph is enabled it will force cgi to always sent Status: 200 with
; every request. PHP's default behavior is to disable this feature.
;cgi.nph = 1

 

; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape
; (iPlanet) web servers, you MAY need to set an environment variable name that PHP
; will look for to know it is OK to continue execution.  Setting this variable MAY
; cause security issues, KNOW WHAT YOU ARE DOING FIRST.
;
;cgi.redirect_status_env =

 

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
;
;cgi.fix_pathinfo=1

 

; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate
; security tokens of the calling client.  This allows IIS to define the
; security context that the request runs under.  mod_fastcgi under Apache
; does not currently support this feature (03/17/2002)
; Set to 1 if running under IIS.  Default is zero.
;
;fastcgi.impersonate = 1

 

; Disable logging through FastCGI connection. PHP's default behavior is to enable
; this feature.
;fastcgi.logging = 0

 

; cgi.rfc2616_headers configuration option tells PHP what type of headers to
; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
; is supported by Apache. When this option is set to 1 PHP will send
; RFC2616 compliant header.
; Default is zero.
;
;cgi.rfc2616_headers = 0

DSO:       动态共享对象支持 它是现代Unix派生出来的操作系统都存在着的一种动态连接机制。
它提供了一种在运行时将特殊格式的代码,在程序运行需要时,将需要的部分从外存调入内存执行的方法

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

#

; Whether to allow HTTP file uploads.
;
file_uploads = On

# Dynamic Shared Object (DSO) Support                   动态共享对象支持

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;
;upload_tmp_dir =

#

; Maximum allowed size for uploaded files.
;
upload_max_filesize = 2M

# To be able to use the functionality of a module which was built as a DSO you   为了能够使用那些以DSO模式编译的模块中的函数,

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

# have to place corresponding `LoadModule' lines at this location so the             你必须有相应的“LoadModule”行   因此,在这里包含了

;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;

# directives contained in it are actually available _before_ they are used.               这些指令,以便能在使用它之前激活

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
;
allow_url_fopen = On

# Statically compiled modules (those listed by `httpd -l') do not need                    那些静态编译的模块不需要在这里列出

; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
;
allow_url_include = Off

# to be loaded here.                                                                                              (使用httpd -l 命令可以列出这些模块)

; Define the anonymous ftp password (your email address). PHP's default setting
; for this is empty.
;
;from="john@doe.com"

#

; Define the User-Agent string. PHP's default setting for this is empty.
;
;user_agent="PHP"

# Example:                             比如

; Default timeout for socket based streams (seconds)
;
default_socket_timeout = 60

# LoadModule foo_module modules/mod_foo.so

; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
;
;auto_detect_line_endings = Off

#

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

LoadModule auth_basic_module modules/mod_auth_basic.so

; If you wish to have an extension loaded automat

LoadModule auth_digest_module modules/mod_auth_digest.so


LoadModule authn_file_module modules/mod_authn_file.so

LoadModule authn_alias_module modules/mod_authn_alias.so

LoadModule authn_anon_module modules/mod_authn_anon.so

LoadModule authn_dbm_module modules/mod_authn_dbm.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule authz_owner_module modules/mod_authz_owner.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_dbm_module modules/mod_authz_dbm.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule ldap_module modules/mod_ldap.so

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

LoadModule include_module modules/mod_include.so

LoadModule log_config_module modules/mod_log_config.so

LoadModule logio_module modules/mod_logio.so

LoadModule env_module modules/mod_env.so

LoadModule ext_filter_module modules/mod_ext_filter.so

LoadModule mime_magic_module modules/mod_mime_magic.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 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 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 substitute_module modules/mod_substitute.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule proxy_ajp_module modules/mod_proxy_ajp.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 cgi_module modules/mod_cgi.so

LoadModule version_module modules/mod_version.so

 

#

# The following modules are not loaded by default:                                 以下模块默认不加载

#

#LoadModule asis_module modules/mod_asis.so

#LoadModule authn_dbd_module modules/mod_authn_dbd.so

#LoadModule cern_meta_module modules/mod_cern_meta.so

#LoadModule cgid_module modules/mod_cgid.so

#LoadModule dbd_module modules/mod_dbd.so

#LoadModule dumpio_module modules/mod_dumpio.so

#LoadModule filter_module modules/mod_filter.so

#LoadModule ident_module modules/mod_ident.so

#LoadModule log_forensic_module modules/mod_log_forensic.so

#LoadModule unique_id_module modules/mod_unique_id.so

#

 

#

# Load config files from the config directory "/etc/httpd/conf.d".              配置文件的加载路径是……

# Incude /usr/local/apache2/conf/ssl.conf
# Include /usr/local/apache2/conf/vhosts/*.conf           这个指令允许在服务器配置文件中加入其它配置文件

Include conf.d/*.conf                                   包括这些配置文件(将/etc/httpd/conf.d中的所有.conf结尾文件包含进来)

 

 

 

此处为Apache的一个安全隐患,可能会暴露过多的信息给访问者,开启此状态,访问者可以在特殊网页看到Apache

配置信息,此处单独写附文1

#

# ExtendedStatus controls whether Apache will generate "full" status    扩展状态控制     server-status 处理程序被调用时  

# information (ExtendedStatus On) or just basic information (ExtendedStatus    ExtendedStatus 为 On时 只生成扩展信息

# Off) when the "server-status" handler is called. The default is Off.                     ExtendedStatus 为 Off时  生成基本信息

#                                                                                                                         默认为off

#ExtendedStatus On                                                (这里的设置要配合后面指令段<Location/server-status>)

 

 

 

#

# If you wish httpd to run as a different user or group, you must run     如果你希望httpd进程运行在不同的用户和组之间

# httpd as root initially and it will switch.                                                  你第一次运行httpd时必须使用root身份,它才能转换

#

# User/Group: The name (or #number) of the user/group to run httpd as. 以用户/组的名字或者编号去运行httpd

#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".     在SCO ODT开放式桌面系统中用User nouser 和 Group nogroup

#  . On HPUX you may not be able to use shared memory as nobody, and the  在惠普9000系列服务器的OS中,用nobody你可能不能

#    suggested workaround is to create a user www and use that user.            使用共享内存。 建议为工作区域建立一个用户 www

#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)  注意一些内核拒绝设置组标识

#  when the value of (unsigned)Group is above 60000;                      当组变量超过60000

#  don't use Group #-1 on these systems!                                              在系统中不要使用组-1

#

User apache                                                 运行httpd的用户和组 

Group apache

 

本文由澳门新萄京官方网站发布于服务器运维,转载请注明出处:澳门新萄京官方网站:配置文件中文版,conf配置

关键词: