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

📄 mpm_common.html

📁 这个是我在web培训时老师提供的手册
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<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/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>
<tr><th><a href="directive-dict.html#Compatibility">兼容性</a></th><td>Apache2.0以后只对全局配置有效</td></tr>
</table>
    <p><code class="directive">Group</code>指令指定了用于对客户端请求提供服务的Apache子进程运行时的用户组。为了使用这个指令,Apache必须以<code>root</code>初始化启动,否则在切换用户组时会失败,并继续以初始化启动时的用户组运行。<var>Unix-group</var>可以是下列之一:</p>

    <dl>
      <dt>用户组的名称</dt>
      <dd>通过名称引用组。</dd>

      <dt>"<code>#</code>"号后跟一个组编号(GID)</dt>
      <dd>通过编号引用组。</dd>
    </dl>

    <div class="example"><h3>示例</h3><p><code>
      Group www-group
    </code></p></div>

    <p>建议你专门为Apache服务器新建一个用户组。一些管理员使用<code>nobody</code>用户,但是这并非总是可用或是合适的。</p>

    <div class="warning"><h3>安全</h3>
      <p>不要将<code class="directive">Group</code>(或<code class="directive"><a href="#user">User</a></code>)设置成<code>root</code> ,除非你明确知道自己在做什么,并且明白其风险所在。</p>
    </div>

    <p>特别提示:在<code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>段中使用该指令已经不再被支持了。你可以使用<code class="program"><a href="../programs/suexec.html">suexec</a></code>的<code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>指令来达到这个目的。</p>

    <div class="note"><h3>注意</h3>
      <p>虽然<code class="directive">Group</code>指令也存在于<code class="module"><a href="../mod/beos.html">beos</a></code>和<code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>MPM中,但是事实上没用任何用处,只不过是个摆饰罢了。</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="Listen" id="Listen">Listen</a> <a name="listen" id="listen">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>服务器监听的IP地址和端口</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</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>, <code class="module"><a href="../mod/event.html">event</a></code></td></tr>
<tr><th><a href="directive-dict.html#Compatibility">兼容性</a></th><td>Apache2.0以后必须设置该指令,<var>protocol</var>参数仅在2.1.5及以后版本中可用</td></tr>
</table>
    <p><code class="directive">Listen</code>指令指示Apache只在指定的IP地址和端口上监听;默认情况下Apache会在所有IP地址上监听。<code class="directive">Listen</code>是一个必须设置的指令。如果在配置文件中找不到这个指令,服务器将无法启动。这和先前的版本不一样。</p>

    <p><code class="directive">Listen</code>指令指定服务器在那个端口或地址和端口的组合上监听接入请求。如果只指定一个端口,服务器将在所有地址上监听该端口。如果指定了地址和端口的组合,服务器将在指定地址的指定端口上监听。</p>

    <p>使用多个<code class="directive">Listen</code>指令可以指定多个不同的监听端口和/或地址端口组合。服务器将会对列出的所有端口和地址端口组合上的请求作出应答。</p>

    <p>例如,想要服务器接受80和8000端口上的请求,可以这样设置:</p>

    <div class="example"><p><code>
      Listen 80<br />
      Listen 8000
    </code></p></div>

    <p>为了让服务器在两个确定的地址端口组合上接受请求,可以这样设置:</p>

    <div class="example"><p><code>
      Listen 192.170.2.1:80<br />
      Listen 192.170.2.5:8000
    </code></p></div>

    <p>IPv6地址必须像下面的例子一样,用方括号括起来:</p>

    <div class="example"><p><code>
      Listen [2001:db8::a00:20ff:fea7:ccea]:80
    </code></p></div>

    <p>可选的<var>protocol</var>参数在大多数情况下并不需要。若未指定该参数,则将为443端口使用默认的<code>https</code>协议,为其它端口使用<code>http</code>协议。在这里指定协议是为了确定使用哪个模块来处理请求,以及根据<code class="directive"><a href="../mod/core.html#acceptfilter">AcceptFilter</a></code>指令根据不同的协议有针对性的进行优化。</p>

    <p>仅在使用非标准端口时才需要指定<var>protocol</var>参数。比如在8443端口运行<code>https</code>协议:</p>

    <div class="example"><p><code>
      Listen 192.170.2.1:8443 https
    </code></p></div>

    <div class="note"><h3>错误条件</h3>
      多个<code class="directive">Listen</code>指令指定了同一个地址和端口的组合后,会导致"<code>Address already in use</code>"错误。
    </div>


<h3>参见</h3>
<ul>
<li><a href="../dns-caveats.html">DNS问题</a></li>
<li><a href="../bind.html">地址和端口绑定</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="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>半链接(pending connection)队列的最大长度</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ListenBacklog <var>backlog</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ListenBacklog 511</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>半链接(pending connection)队列的最大长度。一般不需要调整此项参数,然而在一些系统上,必须增大此值以抵御TCP SYN 洪水攻击。参见操作系统的<code>listen(2)</code>系统调用的后备参数。</p>

    <p>操作系统常常将此值限制为一个较小的数字,具体根据操作系统的不同而不同。需要注意的是,许多操作系统并不是正好使用后备数值,而是取决于设置的值(通常大于后备值)。</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="LockFile" id="LockFile">LockFile</a> <a name="lockfile" id="lockfile">指令</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>LockFile <var>filename</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>LockFile logs/accept.lock</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">LockFile</code>指令设置当<code class="directive"><a href="#acceptmutex">AcceptMutex</a></code>指令的值是<code>fcntl</code>或<code>flock</code>的时候,Apache使用的锁文件的位置。该指令通常保持它的默认值。改变默认值的主要原因是<code>logs</code>目录位于一个NFS文件系统上,因为锁<strong>文件必须位于本地磁盘上</strong>。主服务器进程的PID会自动添加到文件名后面。</p>

    <div class="warning"><h3>安全</h3>
      <p>最好<em>不要</em>将此文件放在任何人都可以具有写权限的目录(比如<code>/var/tmp</code>)中,因为别人可以通过建立一个与服务器企图建立的锁文件同名的文件,来阻止服务器启动,从而造成一个拒绝服务攻击。</p>
    </div>

<h3>参见</h3>
<ul>

⌨️ 快捷键说明

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