⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpm_common.html

📁 这个是我在web培训时老师提供的手册
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="Apache, 中文, 手册, 中文版, 中文手册, 中文版手册, 参考手册, 中文参考手册, 金步国" />
<meta name="description" content="Apache 2.2 中文版参考手册" />
<meta name="author" content="金步国" />
<link href="../style/css/manual-zip.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-zip-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<title>Apache MPM 公共指令 - Apache 2.2 中文版参考手册</title>
</head>
<body><div id="page-header">
<p class="menu"><a href="../mod/index.html">模块索引</a> | <a href="../mod/directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p><p class="apache">Apache HTTP Server 版本2.2</p><img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./index.html"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path"><a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">文档</a> &gt; <a href="../index.html">版本2.2</a> &gt; <a href="./index.html">模块</a></div>

<div id="translation-info">   <a href="../translator_announcement.html#thanks">致谢</a> | <a href="../translator_announcement.html#announcement">译者声明</a> | 本篇译者:<a href="mailto:&#099;sfr&#0097;nk&#0064;&#099;itiz&#046;n&#0101;t">金步国</a> | 本篇译稿最后更新:2006年1月22日 | <a href="../translator_announcement.html#last_new">获取最新版本</a></div>
<div id="page-content"><div id="preamble"><h1>Apache MPM 公共指令</h1>

<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="module">
<tr><th><a href="module-dict.html#Description">说明</a></th><td>收集了被多个多路处理模块(MPM)实现的公共指令</td></tr>
<tr><th><a href="module-dict.html#Status">状态</a></th><td>MPM</td></tr>
</table>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="AcceptMutex" id="AcceptMutex">AcceptMutex</a> <a name="acceptmutex" id="acceptmutex">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Apache用于串行化多个子进程在(多个)网络套接字(socket)上接受请求的方法</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>AcceptMutex Default|<var>method</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>AcceptMutex Default</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="directive">AcceptMutex</code>指令用于设置串行化多个子进程在(多个)网络套接字上接受请求的方法。在2.0版本以前,只能在编译时设定此方法。应当在这里使用的最佳方法取决于不同的硬件体系结构和操作系统。欲知详情,请参见<a href="../misc/perf-tuning.html">性能调节</a>文档。</p>

    <p>如果设置为<code>Default</code> ,那么将会使用编译时自动选择的默认值。其他可用的方法在下面列出。注意,并不是所有的方法在所有的平台上都是可用的,如果指定了一个不可用的方法,将会在错误日志中记录下这个不可用的方法。</p>

    <dl>
      <dt><code>flock</code></dt>
      <dd>这种方法调用系统函数<code>flock(2)</code>来锁定一个加锁文件(其位置取决于<code class="directive"><a href="#lockfile">LockFile</a></code>指令)。</dd>

      <dt><code>fcntl</code></dt>
      <dd>这种方法调用系统函数<code>fcntl(2)</code>来锁定一个加锁文件(其位置取决于<code class="directive"><a href="#lockfile">LockFile</a></code>指令)。</dd>

      <dt><code>posixsem</code></dt>
      <dd>(2.0及更新版本)这种方法使用了POSIX信号灯。如果一个运行中的线程占有了互斥segfault ,则信号灯的所有者将不会被恢复,从而导致服务器的挂起和失去响应。</dd>

      <dt><code>pthread</code></dt>
      <dd>(1.3及更新版本)这种方法使用了POSIX互斥,按理应该可以用于所有完整实现了POSIX线程规范的体系中,但是似乎只能用在Solaris2.5及更新版本中,甚至只能在某种配置下才正常运作。如果遇到这种情况,则应该提防服务器的挂起和失去响应。只提供静态内容的服务器可能不受影响。</dd>

      <dt><code>sysvsem</code></dt>
      <dd>(1.3及更新版本)这种方案使用SysV风格的信号灯以实现互斥。不幸的是,SysV风格的信号灯有一些副作用,其一是,Apache有可能不能在结束以前释放这种信号灯(见<code>ipcs()</code>的man page),另外,这种信号灯API给与网络服务器有相同uid的CGI提供了拒绝服务攻击的机会(所有CGI,除非用了类似<code class="program"><a href="../programs/suexec.html">suexec</a></code>或<code>cgiwrapper</code>)。鉴于此,在多数体系中都不用这种方法,除了IRIX(因为加锁文件的方法在IRIX中代价太高)。</dd>
    </dl>

    <p>如果你想知道编译时自动选择的默认值,你可以将<code class="directive"><a href="../mod/core.html#loglevel">LogLevel</a></code>设为<code>debug</code> ,这样默认的<code class="directive">AcceptMutex</code>就会记录到<code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code>中。</p>

  <div class="warning"><h3>警告</h3>
     <p>在大多数系统上,使用<code>pthread</code>时,如果一个子进程在持有<code>AcceptCntl</code>互斥信号时异常中止,服务器将会挂起和失去响应,此时必须手动重启服务器才能解决问题。但Solaris是一个例外,因为它提供了一个机制(Apache利用了该机制),允许在一个持有互斥信号的子进程异常中止后恢复互斥信号。</p>
     <p>如果你的操作系统实现了<code>pthread_mutexattr_setrobust_np()</code>函数,基本上就能安全的使用<code>pthread</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="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Apache使用的内核转储目录</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>CoreDumpDirectory <var>directory</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/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使用的内核转储目录。默认位于<code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>下,因为这个目录通常对于运行服务器的用户是不可写的,内核转储一般也就不会写入内容。如果你在调试中需要内核转储,你可以用这个指令来指定另外一个目录。</p>

    <div class="note"><h3>Linux上的内核转储</h3>
      <p>如果Apache以root身份启动并切换至其他用户,即使指定的转储目录对进程是可写的,Linux内核也将<em>禁止</em>Apache进行内核转储。但是Apache2.0.46及以后的版本在你明确指定<code class="directive">CoreDumpDirectory</code>的情况下,能够在Linux2.4以上的版本中强制实现内核转储。</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="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">指令</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>EnableExceptionHook On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>EnableExceptionHook Off</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>
<tr><th><a href="directive-dict.html#Compatibility">兼容性</a></th><td>仅在 Apache 2.0.49 及以后的版本中可用</td></tr>
</table>
    <p>因为安全原因,这个指令仅在编译时使用了 <code>--enable-exception-hook</code> 选项的情况下才可用。它会在一个子进程崩溃以后启用一个钩子(hook)来运行一个外部模块以做些后继处理。</p>
    
    <p>目前有两个模块(<code>mod_whatkilledus</code>和<code>mod_backtrace</code>)可以被钩子使用。请参见Jeff Trawick的<a href="http://www.apache.org/~trawick/exception_hook.html">EnableExceptionHook site</a>以获得更多信息。</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="GracefulShutdownTimeout" id="GracefulShutdownTimeout">GracefulShutdownTimeout</a> <a name="gracefulshutdowntimeout" id="gracefulshutdowntimeout">指令</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>GracefulShutDownTimeout <var>seconds</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>GracefulShutDownTimeout 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/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/event.html">event</a></code></td></tr>
<tr><th><a href="directive-dict.html#Compatibility">兼容性</a></th><td>仅在 Apache 2.2 及以后的版本中可用</td></tr>
</table>
    <p><code class="directive">GracefulShutdownTimeout</code>设置服务器在收到"优雅停止"信号后最多允许使用多少秒来处理尚未完成的连接,超时后服务器将强行退出。</p>

    <p>设为"0"表示永不超时,也就是服务器必须在处理完所有尚未完成的请求之后才能退出。</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="Group" id="Group">Group</a> <a name="group" id="group">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>对请求提供服务的Apache子进程运行时的用户组</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>Group <var>unix-group</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>Group #-1</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -