码迷,mamicode.com
首页 > Web开发 > 详细

apache 配置文件之(贰)

时间:2015-04-14 20:12:28      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:operation   配置文件   running   number   finding   

### Section 1: Global Environment

第一部分:全局环境配置

#

# The directives in this section affect theoverall operation of Apache,

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

# can find its configuration files.

#这部分的指令将影响所有apache的操作,比如在这可以找到处理并发请

求的数量的配置文件。

 

#

# Don‘t give away too muchinformation about all the subcomponents

 we arerunning.

不要放弃太多关于我们正在运行的子组件的信息。

 Comment outthis line if you don‘t mind remote sites

 finding outwhat major optional modules you are running

注释掉该行,如果你不介意远程站点发现你的apache正在运行哪些主要可选模块

ServerTokens OS

配置HTTPserver:”响应头

该指令控制了服务器回应给client端的“server应答头是否包含关于服务器操作

系统类型和编译进行的模块描述信息。

1,  隐藏PHP版本

Expose_php  Off

2,  隐藏apache版本

ServerTokens  Prod

# ServerRoot: The top of the directory treeunder which the server‘s

# configuration, error, and log files arekept.

#根目录设置:该选项是服务器配置,错误配置和日志配置文件的根目录

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

注意,如果你打算把这个位置设置为NFS或其它网络位置

# mounted filesystem then please read theLockFile documentation

挂载文件系统然后阅读lockfile文档

# (available at<URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);

# you will save yourself a lot of trouble.

#这样你会为自己省下不少麻烦

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

#不要在目录的结束路径后添加斜杠

ServerRoot "/etc/httpd"

 

#

# PidFile: The file in which the servershould record its process

PIDFILEapache运行的时候,该文件记录的是apache进程的id

# identification number when itstarts.  Note the PIDFILE variable in

# /etc/sysconfig/httpd must be setappropriately if this location is

# changed.

注意,httpd脚本文件中PID变量需随着这个位置的设置的改变而改变

#

PidFile run/httpd.pid

 

#

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

#接收和发送的超时时间

TIMEout指令用于设置apache等待一下三种事件的时间长度

1,  接受一个GET请求耗费的总时间

2,  POSTPUT请求时,接受两个TCP包之间的时间

3,  应答时TCP包传输中两个ACK包之间的时间

Timeout 60

 

#

# KeepAlive: Whether or not to allowpersistent connections (more than

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

#是否允许持久连接,一次连接,多次请求,设置off关闭持久连接

KeepAlive Off

 

#

# MaxKeepAliveRequests: The maximum numberof requests to allow

# during a persistent connection.

持久连接期间允许请求的最大数

Set to 0 to allow an unlimited amount.

设置0表示没有限制

# We recommend you leave this numberhigh, for maximum performance.

为了保证服务器最优性能,我们建议你将该值设大

MaxKeepAliveRequests 100

 

#

# KeepAliveTimeout: Number of seconds towait for the next request from the

# same client on the same connection.

# 对待同一客户端的连接,如果等待15S后还为到达,就断开

KeepAliveTimeout 15

 

##

## Server-Pool Size Regulation (MPMspecific)

## 服务器池大小调节,MPM具体设置

 

# prefork MPM

# StartServers: number of server processesto start

启动apache时的服务进程数

# MinSpareServers: minimum number of serverprocesses which are kept spare

最小数量空闲服务器进程

# MaxSpareServers: maximum number of serverprocesses which are kept spare

最大数量空闲服务器进程

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

对于preforkMPM,这个指令设置了MaxClients最大允许配置的数值。对于workerMPM,这个指令和ThreadLimit结合使用设置了MaxClients最大允许配置的数值。任何在重启期间对这个指令的改变都将被忽略,但对MaxClients的修改却会生效。

 

# MaxClients: maximum number of serverprocesses allowed to start

MaxClients指令设置了允许同时伺服的最大接入请求数量。任何超过MaxClients限制的请求都将进入等候队列,直到达到ListenBacklog指令限制的最大值为止。一旦一个链接被释放,队列中的请求将得到服务。

# MaxRequestsPerChild: maximum number ofrequests a server process serves

MaxRequestsPerChild指令设置每个子进程在其生存期内允许伺服的最大请求数量。到达MaxRequestsPerChild的限制后,子进程将会结束。如果MaxRequestsPerChild"0",子进程将永远不会结束。

 

<IfModule prefork.c>

StartServers       8

MinSpareServers    5

MaxSpareServers   20

ServerLimit      256

MaxClients       256

MaxRequestsPerChild  4000

</IfModule>

 

END


本文出自 “百折不回” 博客,请务必保留此出处http://changbo.blog.51cto.com/1316452/1632162

apache 配置文件之(贰)

标签:operation   配置文件   running   number   finding   

原文地址:http://changbo.blog.51cto.com/1316452/1632162

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!