📄 mpm_common.html
字号:
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>服务器用于记录父进程(监控进程)PID的文件</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>PidFile <var>filename</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>PidFile logs/httpd.pid</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
</table>
<p><code class="directive">PidFile</code>指令设置服务器用于记录父进程(监控进程)PID的文件。如果指定的不是绝对路径,那么将视为基于<code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>的相对路径。</p>
<div class="example"><h3>示例</h3><p><code>
PidFile /var/run/apache.pid
</code></p></div>
<p>这个文件通常用来便于给服务器父进程发送一个信号,用于关闭或重启服务器,以重新打开<code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code>和<code class="directive"><a href="../mod/mod_log_config.html#transferlog">TransferLog</a></code>文件、重新读取配置文件。这些可以通过发送一个"SIGHUP"(kill -1)信号到<code class="directive">PidFile</code>记录的进程PID。</p>
<p><code class="directive">PidFile</code>和其他日志文件一样要注意放置位置和<a href="../misc/security_tips.html#serverroot">安全</a>问题。</p>
<div class="note"><h3>注意</h3>
<p>从Apache2开始,推荐使用<code class="program"><a href="../programs/apachectl.html">apachectl</a></code>脚本来启动或停止服务器。</p>
</div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>TCP接收缓冲区大小(字节)</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ReceiveBufferSize 0</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
</table>
<p>这个指令设置服务器的TCP接收缓冲区的大小(字节)。提高这个值会导致两个后果:高速度和高潜伏时间(100ms左右)。</p>
<p>如果设置为"<code>0</code>",将使用操作系统默认值。</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>存储子进程协调数据(coordination data)的文件</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ScoreBoardFile logs/apache_status</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
</table>
<p>Apache使用记分板(scoreboard)在父进程和子进程之间进行通信。一些体系结构要求有一个文件来帮助通信。如果未指定这个文件,Apache会首先尝试在匿名共享内存中建立完整的记分板(scoreboard),若失败,将继续尝试使用基于文件的共享存储器在磁盘上建立这个文件。若利用这个指令指定这个文件的位置,则Apache将总是在磁盘上建立这个文件。</p>
<div class="example"><h3>示例</h3><p><code>
ScoreBoardFile /var/run/apache_status
</code></p></div>
<p>基于文件的共享存储器对于使用直接访问记分板(scoreboard)的第三方程序是很有用的。</p>
<p>将<code class="directive">ScoreBoardFile</code>放置在RAM disk中会对速度提升有很大帮助。但是同其他日志文件一样也要注意放置位置和<a href="../misc/security_tips.html">安全</a>问题。</p>
<h3>参见</h3>
<ul>
<li><a href="../stopping.html">停止和重启Apache</a></li>
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>TCP发送缓冲区大小(字节)</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>SendBufferSize 0</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
</table>
<p>这个指令设置服务器的TCP发送缓冲区的大小(字节)。提高这个值会导致两个后果:高速度和高潜伏时间(100ms左右)。</p>
<p>如果设置为"<code>0</code>",将使用操作系统默认值。</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>服务器允许配置的进程数上限</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ServerLimit <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>参见下面的说明</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td><code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
</table>
<p>对于<code class="module"><a href="../mod/prefork.html">prefork</a></code>MPM,这个指令设置了<code class="directive"><a href="#maxclients">MaxClients</a></code>最大允许配置的数值。对于<code class="module"><a href="../mod/worker.html">worker</a></code>MPM,这个指令和<code class="directive"><a href="#threadlimit">ThreadLimit</a></code>结合使用设置了<code class="directive"><a href="#maxclients">MaxClients</a></code>最大允许配置的数值。任何在重启期间对这个指令的改变都将被忽略,但对<code class="directive"><a href="#maxclients">MaxClients</a></code>的修改却会生效。</p>
<p>使用这个指令时要特别当心。如果将<code class="directive">ServerLimit</code>设置成一个高出实际需要许多的值,将会有过多的共享内存被分配。如果将<code class="directive">ServerLimit</code>和<code class="directive"><a href="#maxclients">MaxClients</a></code>设置成超过系统的处理能力,Apache可能无法启动,或者系统将变得不稳定。</p>
<p>对于<code class="module"><a href="../mod/prefork.html">prefork</a></code>MPM,只有在你需要将<code class="directive"><a href="#maxclients">MaxClients</a></code>设置成高于默认值256的时候才需要使用这个指令。要将此指令的值保持和<code class="directive"><a href="#maxclients">MaxClients</a></code>一样。</p>
<p>对于<code class="module"><a href="../mod/worker.html">worker</a></code>MPM,只有在你需要将<code class="directive"><a href="#maxclients">MaxClients</a></code>和<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>设置成需要超过默认值16个子进程的时候才需要使用这个指令。不要将该指令的值设置的比<code class="directive"><a href="#maxclients ">MaxClients </a></code>和<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>需要的子进程数量高。</p>
<div class="note"><h3>注意</h3>
<p>Apache在编译时内部有一个硬限制"<code>ServerLimit 20000</code>"(对于<code class="module"><a href="../mod/prefork.html">prefork</a></code>MPM为"<code>ServerLimit 200000</code>")。你不能超越这个限制。</p>
</div>
<h3>参见</h3>
<ul>
<li><a href="../stopping.html">停止和重启Apache</a></li>
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>服务器启动时建立的子进程数</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>StartServers <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>参见下面的说明</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -