blob: dfa678b13bb6df5875ef2f0cf49ac1e5e5e10bf3 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
<!-- English Revision: 674934:1805221 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<modulesynopsis metafile="mpm_common.xml.meta">
<name>mpm_common</name>
<description>二つ以上のマルチプロセッシングモジュール (MPM)
で実装されているディレクティブのコレクション</description>
<status>MPM</status>
<directivesynopsis>
<name>AcceptMutex</name>
<description>複数の子プロセスがネットワークソケットでリクエストを
accept しようとしているときに、Apache がそれらの子プロセスを直列化するために
使う方法</description>
<syntax>AcceptMutex Default|<var>method</var></syntax>
<default>AcceptMutex Default</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>
<usage>
<p><directive>AcceptMutex</directive> ディレクティブは、
ネットワークソケットのリクエストを accept しようとしている複数の子プロセスを
Apache が直列化するために使う方法(と必要ならロックファイルの場所)を設定します。
Apache 2.0 以前は、このメソッドはコンパイル時にのみ選択できました。
最適な方法は、アーキテクチャやプラットホームに大きく依存します。
詳細に関しては、<a
href="../misc/perf-tuning.html">性能のチューニング</a>
ドキュメントをご覧下さい。</p>
<p>このディレクティブが <code>Default</code>
に設定されていれば、コンパイル時に選択されたデフォルト値が使われます。
他の使用可能なメソッドの一覧は下にあります。
全てのメソッドが全てのプラットホームで使用可能であるわけではない、
ということに注意してください。
使用可能でないメソッドが指定された場合は、
使用可能なメソッドの一覧を含んだメッセージが
エラーログに出力されます。</p>
<dl>
<dt><code>flock&lt;<var>:/path/to/lockfile</var>&gt;</code></dt>
<dd>オプションの <var>/path/to/lockfile</var>
パラメータで定義したファイルのロックに、
<code>flock(2)</code> システムコールを使います。
ロックファイルの指定には <directive module="mpm_common">LockFile</directive>
ディレクティブを使うことも出来ます(非推奨です)。</dd>
<dt><code>fcntl&lt;<var>:/path/to/lockfile</var>&gt;</code></dt>
<dd>オプションの <var>/path/to/lockfile</var>
パラメータで定義したファイルのロックに、
<code>fcntl(2)</code> システムコールを使います。
ロックファイルの指定には <directive module="mpm_common">LockFile</directive>
ディレクティブを使うことも出来ます(非推奨です)。</dd>
<dt><code>file&lt;<var>:/path/to/lockfile</var>&gt;</code></dt>
<dd>使用できるファイルロックルーチンの中で最適なものを使います。
具体的には、<code>fcntl</code> が使用可能な場合はそれを使い、そうでない場合は
<code>flock</code> を試します。
この設定はプラットホームと <glossary>APR</glossary> が二つのうち少なくとも
一つをサポートしている場合のみ使用可能です。</dd>
<dt><code>posixsem</code></dt>
<dd>排他処理の実装に POSIX 互換セマフォを使用します</dd>
<dt><code>sysvsem</code></dt>
<dd>排他処理の実装に SySV 形式のセマフォを使います。</dd>
<dt><code>sem</code></dt>
<dd>使用できるセマフォルーチンの中で最適なものを使います。
具体的には、Posix 互換セマフォが使用可能な場合はそれを使い、そうでない場合は
SystemV IPC 形式のセマフォを試します。
この設定はプラットホームと <glossary>APR</glossary> が二つのうち少なくとも
一つをサポートしている場合のみ使用可能です。</dd>
<dt><code>pthread</code></dt>
<dd>POSIX Threads (PThreads) 規格で実装されている
POSIX 排他処理を使います。</dd>
</dl>
<p>コンパイル時にシステムのデフォルトに選ばれたものが何かを見たい場合は、
<directive module="core">LogLevel</directive><code>debug</code>
に設定するとよいでしょう。デフォルトの <directive>AcceptMutex</directive>
<directive module="core">ErrorLog</directive> に書き込まれます。</p>
<note type="warning"><title>警告</title>
<p>ほとんどのシステムにおいては、<code>pthread</code> オプションが
選ばれていると、子プロセスが <code>AcceptCntl</code> mutex を
保持しているときに異常終了した場合、サーバはリクエストへの応答を
停止してしまいます。これが発生した場合は、サーバを復旧させるためには
手動で再起動させる必要があります。</p>
<p>Solaris は例外で、Apache も使用している、子プロセスが mutex を
保持して異常終了した後に mutex を復旧させるための機構を提供をしています。</p>
<p>御使用のシステムが <code>pthread_mutexattr_setrobust_np()</code> 関数を
実装している場合は、<code>pthread</code> オプションを安全に使用できる
可能性があります。</p>
</note>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>CoreDumpDirectory</name>
<description>Apache がコアダンプする前に移動を試みるディレクトリ
</description>
<syntax>CoreDumpDirectory <var>directory</var></syntax>
<default>デフォルトの設定は説明文を読んでください</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_winnt</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>
<usage>
<p>Apache がコアダンプする前に移動を試みるディレクトリを制御します。
デフォルト値は <directive module="core">ServerRoot</directive>
ディレクトリですが、このディレクトリはサーバの実行されているユーザ権限で
書き込み可能であるべきではないので、通常はコアダンプは書き込まれません。
デバッグのためにコアダンプが必要であれば、
このディレクティブを使って他の位置にコアダンプを書き出すようにできます。</p>
<note><title>Linux でのコアダンプ</title>
<p>Apache が root として起動されて、別のユーザの権限に以降した場合は
Linux のカーネルはディレクトリがプロセスの権限で書き込み可能な場合でさえも
コアダンプを<em>無効</em>にします。Apache (2.0.46 以降) は
Linux 2.4 以降ではコアダンプを行なうように再指定しますが、それは
<directive>CoreDumpDirectory</directive> を明示的に設定したときに
限ります。</p>
</note>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>EnableExceptionHook</name>
<description>クラッシュの後に例外ハンドラを実行するフックを有効にする</description>
<syntax>EnableExceptionHook On|Off</syntax>
<default>EnableExceptionHook Off</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module>
<module>worker</module></modulelist>
<compatibility>2.0.49 以降</compatibility>
<usage>
<p>安全上の理由から、<code>--enable-exception-hook</code> configure
オプションを有効にした場合にのみ、このディレクティブを利用できます。
外部モジュールをプラグインして、子がクラッシュした後に何か実行できるような
フックを有効にします。</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>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>GracefulShutdownTimeout</name>
<description>穏やかな停止をかけた後、終了するまで待つ時間</description>
<syntax>GracefulShutDownTimeout <var>seconds</var></syntax>
<default>GracefulShutDownTimeout 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>prefork</module><module>worker</module>
<module>event</module></modulelist>
<compatibility>2.2 以降</compatibility>
<usage>
<p><directive>GracefulShutdownTimeout</directive> には
サーバーが "graceful-stop" シグナルを受け取ってから現在の
リクエストの処理を最大で何秒間続けるかを指定します。</p>
<p>この値をゼロに設定すると、処理中として残っているリクエストが
全て完了するまでサーバーは終了しません。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>Group</name>
<description>リクエストに応答する際に所属するグループ</description>
<syntax>Group <var>unix-group</var></syntax>
<default>Group #-1</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>
<compatibility>Apache 2.0 以降で、グローバル設定でのみ有効です。</compatibility>
<usage>
<p><directive>Group</directive> ディレクティブで、
リクエストに応答する際に所属しておくグループを設定します。
このディレクティブを使用するためには、
サーバは最初に <code>root</code> 権限で起動されている必要があります。
非 root ユーザでサーバを起動した場合は、指定したグループに変化できずに、
結果的に起動したユーザの属するグループで実行されることになります。
<var>unix-group</var> は次のうちのいずれかです:</p>
<dl>
<dt>グループ名</dt>
<dd>グループを名前で参照します</dd>
<dt><code>#</code> に続いてグループ番号</dt>
<dd>グループを番号で参照します。</dd>
</dl>
<example><title></title>
Group www-group
</example>
<p>サーバを実行するために特定の新しいグループを設定することを
お薦めします。<code>nobody</code> を使用する管理者もいますが、
可能であったり望ましい訳では必ずしもありません。</p>
<note type="warning"><title>セキュリティ</title>
<p>正確にどんなことをやっているのか、その危険性を知らないで、
<directive>Group</directive> (や <directive
module="mpm_common">User</directive>) を
<code>root</code> に 設定しないでください。</p>
</note>
<p>特記事項: このディレクティブを
<directive module="core" type="section">VirtualHost</directive>
で使用することはサポートされなくなりました。Apache 2.0 で
<program>suexec</program> を設定したい場合は、
<directive module="mod_suexec">SuexecUserGroup</directive>
を使用してください。</p>
<note><title>注意</title>
<p><directive>Group</directive> ディレクティブは
<module>beos</module><module>mpmt_os2</module> MPM
にも存在しますが、実質的に無効で、互換性のためだけに存在します。</p>
</note>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>PidFile</name>
<description>デーモンのプロセス ID
をサーバが記録するためのファイル</description>
<syntax>PidFile <var>filename</var></syntax>
<default>PidFile logs/httpd.pid</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_winnt</module><module>mpmt_os2</module>
<module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>
<usage>
<p><directive>PidFile</directive> ディレクティブで、
デーモンのプロセス ID をサーバが記録するファイルを設定します。
ファイル名が絶対パスでない場合は、
<directive module="core">ServerRoot</directive>
からの相対的なものとして扱われます。</p>
<example><title></title>
PidFile /var/run/apache.pid
</example>
<p>サーバが <directive module="core">ErrorLog</directive>
<directive module="mod_log_config">TransferLog</directive>
を閉じて開き直したり、設定ファイルを
再読込したりさせるために、サーバにシグナルを送ることができると
便利なことがあります。
これは SIGHUP (kill -1) シグナルを <directive>PidFile</directive>
に書かれているプロセス ID に送ることでできます。</p>
<p><directive>PidFile</directive> には、ログファイルの設置位置や
<a href="../misc/security_tips.html#serverroot">セキュリティ</a>
と全く同じ注意点があります。</p>
<note><title>注意</title>
<p>Apache 2 では、
<program>apachectl</program>
スクリプトのみを使用してサーバの (再) 起動や停止を
行なうことを推奨しています。</p>
</note>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>Listen</name>
<description>サーバが listen するIP アドレスとポート番号</description>
<syntax>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</syntax>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
<module>event</module>
</modulelist>
<compatibility>Apache 2.0 から必須ディレクティブ。<var>protocol</var>
引数は 2.1.5 で追加。</compatibility>
<usage>
<p><directive>Listen</directive> ディレクティブは Apache
が特定の IP アドレスやポート番号だけを listen するように指定します。
デフォルトでは全ての IP インターフェースのリクエストに応答します。
<directive>Listen</directive> ディレクティブは
現在は必須のディレクティブとなりました。
もし設定ファイルになければ、サーバは起動に失敗します。
これは以前のバージョンの Apache から変更のあった部分です。</p>
<p><directive>Listen</directive> ディレクティブでは、特定のポートあるいは
アドレスとポートの組み合わせから入ってくるリクエストに対して
応答するように指定します。
もしポート番号だけが指定された場合は、サーバは全インターフェースの
指定されたポート番号に対して listen します。
IP アドレスがポートとともに指定された場合は、
サーバは指定されたポートとインターフェースに対して listen
します。</p>
<p>複数のアドレスとポートに対して listen するように、
複数の <directive>Listen</directive> ディレクティブを使うこともできます。
サーバは列挙されたアドレスとポート全てからのリクエストに対して
応答します。</p>
<p>例えば、サーバが 80 番ポートと 8000 番ポートの両方の
コネクションを受け入れる場合は、次のようにします。</p>
<example>
Listen 80<br />
Listen 8000
</example>
<p>二つの特定のインターフェースとポート番号からのコネクションを
受け入れるようにするには、次のようにします。</p>
<example>
Listen 192.170.2.1:80<br />
Listen 192.170.2.5:8000
</example>
<p>IPv6 アドレスは角括弧で囲まなければなりません。
例えば次の例のようにです。</p>
<example>
Listen [2001:db8::a00:20ff:fea7:ccea]:80
</example>
<p><var>protocol</var> オプション引数は通常の設定では必要ありません。
無指定の場合、443 番ポートには <code>https</code> が、他のポートには
<code>http</code> がデフォルト値として使用されます。
protocol 指定は、どのモジュールがリクエストを処理するかを決定し、
<directive module="core">AcceptFilter</directive>
によるプロトコル特有の最適化を行うようにします。</p>
<p>非標準なポートで運用している際にのみ protocol 指定が必要になります。
たとえば <code>https</code> なサイトを 8443 番ポートで運用している場合 :</p>
<example>
Listen 192.170.2.1:8443 https
</example>
<note><title>エラー条件</title>
同一 IP アドレスとポートの組に、複数の <directive>Listen</directive>
ディレクティブを指定してしまうと、<code>Address already in use</code>
というエラーメッセージを受けることになります。
</note>
</usage>
<seealso><a href="../dns-caveats.html">DNS の問題</a></seealso>
<seealso><a href="../bind.html">Apache
が使用するアドレスとポートの設定</a></seealso>
</directivesynopsis>
<directivesynopsis>
<name>ListenBackLog</name>
<description>保留状態のコネクションのキューの最大長</description>
<syntax>ListenBacklog <var>backlog</var></syntax>
<default>ListenBacklog 511</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>
<usage>
<p>保留状態のコネクションのキューの最大長です。
一般的には調整する必要はありませんし、調整は望ましくありません。
しかし、TCP SYN フラッドアタックの状況下におかれる場合に、
増やした方が望ましいシステムもあります。
<code>listen(2)</code> システムコールのバックログパラメータを
ご覧下さい。</p>
<p>この値は OS により、小さな数に抑えられます。
値は OS 毎に異なっています。また多くの OS では、
バックログとして指定されている値ちょうどまで使っているわけではなく、
設定されている値に基づいて (通常は設定値よりも大きな値を)
使っていることに注意してください。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>LockFile</name>
<description>受付を直列化するためのロックファイルの位置<em>(非推奨)</em></description>
<syntax>LockFile <var>filename</var></syntax>
<default>LockFile logs/accept.lock</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>
<usage>
<p><directive module="mpm_common">AcceptMutex</directive>
<code>fcntl</code><code>flock</code>
に設定されて使用されている場合に、使用されるロックファイルへのパスを
<directive>LockFile</directive> ディレクティブで設定します。
このディレクティブは通常はそのままにしておきます。
主に <code>logs</code> ディレクトリが NFS
でマウントされている場合などに値を変えます。
なぜなら<strong>ロックファイルはローカルディスクに
保存されなければならない</strong>からです。
メインサーバプロセスの PID がファイル名に自動的に付加されます。</p>
<note type="warning"><title>セキュリティ</title>
<p><code>/var/tmp</code>
といった、誰でも書き込めるディレクトリにファイルを
<em>置かない</em>方がよいです。なぜなら、サーバが起動時に作成する
ロックファイルの作成自体を妨害することによって、
誰でもサービス拒否アタックを引き起こすことができるからです。</p>
</note>
<note type="warning"><title>非推奨</title>
<p>このディレクティブは非推奨です。 <directive
module="mpm_common">AcceptMutex</directive>
ディレクティブで排他処理の方法の指定とともにロックファイルの場所も指定してください。</p>
</note>
</usage>
<seealso><directive module="mpm_common">AcceptMutex</directive></seealso>
</directivesynopsis>
<directivesynopsis>
<name>MaxClients</name>
<description>リクエストに応答するために作成される
子プロセスの最大個数</description>
<syntax>MaxClients <var>number</var></syntax>
<default>詳細は使用法をご覧下さい。</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>
<usage>
<p><directive>MaxClients</directive> ディレクティブは、
応答することのできる同時リクエスト数を設定します。
<directive>MaxClients</directive> 制限数を越えるコネクションは通常、
<directive module="mpm_common">ListenBacklog</directive>
ディレクティブで設定した数までキューに入ります。
他のリクエストの最後まで達して子プロセスが空くと、
次のコネクションに応答します。</p>
<p>スレッドを用いないサーバ (<em>すなわち</em> <module>prefork</module>)
では、<directive>MaxClients</directive>
は、リクエストに応答するために起動される
子プロセスの最大数となります。
デフォルト値は <code>256</code> で、これを増加させたい場合は、
<directive module="mpm_common">ServerLimit</directive>
の値も増加させる必要があります。</p>
<p>スレッドを用いるサーバや、ハイブリッドサーバ (<em>すなわち</em>
<module>beos</module> <module>worker</module>)
では、<directive>MaxClients</directive>
は、クライアントに応答できるスレッドの総数を制限します。
<module>beos</module> でのデフォルト値は <code>50</code> です。
ハイブリッド MPM でのデフォルト値は <code>16</code>
<directive module="mpm_common">ServerLimit</directive>
<code>25</code> 倍 (<directive
module="mpm_common">ThreadsPerChild</directive>) です。
<directive>MaxClients</directive>
を 16 プロセス以上必要な値まで増加させたい場合は、
<directive module="mpm_common">ServerLimit</directive>
も増加させる必要があります。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>MaxMemFree</name>
<description><code>free()</code> が呼ばれない限り、
主メモリアロケータが保持し続けられるメモリの最大量</description>
<syntax>MaxMemFree <var>KBytes</var></syntax>
<default>MaxMemFree 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>prefork</module>
<module>threadpool</module><module>worker</module><module>mpm_winnt</module></modulelist>
<usage>
<p><directive>MaxMemFree</directive> ディレクティブは
<code>free()</code> が呼ばれない限り、
主アロケータが保持できる空のメモリの最大値をキロバイト単位で設定します。
設定されていないか、零に設定されているときは、無制限になります。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>MaxRequestsPerChild</name>
<description>個々の子サーバが稼働中に扱うリクエスト数の上限</description>
<syntax>MaxRequestsPerChild <var>number</var></syntax>
<default>MaxRequestsPerChild 10000</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpm_netware</module>
<module>mpm_winnt</module><module>mpmt_os2</module>
<module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>
<usage>
<p><directive>MaxRequestsPerChild</directive> ディレクティブは、
個々の子サーバプロセスが扱うことのできるリクエストの制限数を
設定します。<directive>MaxRequestsPerChild</directive>
個のリクエストの後に、子プロセスは終了します。
<directive>MaxRequestsPerChild</directive><code>0</code>
に設定されている場合は、プロセスは期限切れにより終了することはありません。</p>
<note><title>その他のデフォルト値</title>
<p><module>mpm_netware</module><module>mpm_winnt</module>
でのデフォルト値は <code>0</code> です。</p>
</note>
<p><directive>MaxRequestsPerChild</directive>
を非ゼロにすることにより、(偶発的な) メモリーリークが起こった場合に
プロセスが消費するメモリの総量を制限できます。</p>
<note><title></title>
<p><directive module="core">KeepAlive</directive> リクエストの場合は、
一つ目のリクエストだけがこの制限に該当します。
実効的には、一つの子プロセスあたりの<em>コネクション</em>数を
制限するように挙動が変化します。</p>
</note>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>MaxSpareThreads</name>
<description>アイドルスレッドの最大数</description>
<syntax>MaxSpareThreads <var>number</var></syntax>
<default>詳細は使用法をご覧下さい。</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpmt_os2</module>
<module>perchild</module><module>threadpool</module><module>worker</module>
</modulelist>
<usage>
<p>アイドルなスレッドの最大数です。異なる MPM ではそれぞれ、
このディレクティブは異なる取り扱われ方をされます。</p>
<p><module>perchild</module> では、
デフォルトは <code>MaxSpareThreads 10</code> です。
この MPM はアイドルスレッド数を、それぞれの子プロセスごとに監視します。
子プロセスにアイドルスレッドが多すぎる場合は、
サーバはその子プロセスに含まれるスレッドを終了し始めます。</p>
<p><module>worker</module>, <module>leader</module>,
<module>threadpool</module> では、
デフォルトは <code>MaxSpareThreads 250</code> です。
この MPM はアイドルスレッド数をサーバ全体で監視します。
サーバでアイドルスレッド数が多すぎる場合は、
この数字よりも少ない数になるまで子プロセスを終了します。</p>
<p><module>mpm_netware</module> では、
デフォルトは <code>MaxSpareThreads 100</code> です。
この MPM はシングルプロセスで実行されますので、
スペアスレッド数もサーバ全体で勘定します。</p>
<p><module>beos</module><module>mpmt_os2</module>
<module>mpm_netware</module> と似た挙動をします。
<module>beos</module> でのデフォルト値は <code>MaxSpareThreads 50</code>
です。<module>mpmt_os2</module> でのデフォルト値は <code>10</code>
です。</p>
<note><title>制限事項</title>
<p><directive>MaxSpareThreads</directive> の取る値には制限があります。
Apache は次の規則に従って自動的に補正します。</p>
<ul>
<li><module>perchild</module> では、
<directive>MaxSpareThreads</directive>
<directive module="mpm_common">ThreadLimit</directive>
と等しいかそれ以下である必要があります。</li>
<li><module>mpm_netware</module>
<directive module="mpm_common">MinSpareThreads</directive>
よりも大きい必要があります。</li>
<li><module>leader</module>, <module>threadpool</module>,
<module>worker</module> では、
<directive module="mpm_common">MinSpareThreads</directive>
<directive module="mpm_common">ThreadsPerChild</directive>
で決まる総和と等しいか大きい必要があります。</li>
</ul>
</note>
</usage>
<seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
</directivesynopsis>
<directivesynopsis>
<name>MinSpareThreads</name>
<description>リクエストに応答することのできる
アイドルスレッド数の最小数</description>
<syntax>MinSpareThreads <var>number</var></syntax>
<default>詳細は使用方法をご覧下さい。</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpmt_os2</module>
<module>perchild</module><module>threadpool</module><module>worker</module>
</modulelist>
<usage>
<p>リクエストに応答するスレッド数の最小値です。
異なる MPM ではそれぞれ、
このディレクティブは異なる取り扱われ方をします。</p>
<p><module>perchild</module> では、
デフォルトは <code>MinSpareThreads 5</code> で、
アイドルスレッド数を子プロセス毎に監視します。
もし子プロセスに十分な数のスレッドがなければ、
サーバはその子プロセスに新しいスレッドを作り始めます。
ですから、<directive module="perchild">NumServers</directive>
<code>10</code> に、<directive>MinSpareThreads</directive>
<code>5</code> にした場合は、最小でも 50 のアイドルスレッドが
システム上にあることになります。</p>
<p><module>worker</module>, <module>leader</module>,
<module>threadpool</module> では、
デフォルトは <code>MinSpareThreads 75</code> で、
アイドルスレッド数をサーバ全体で監視します。
もしサーバに十分な数のアイドルスレッドがなければ、
アイドルスレッド数がこの数 <var>number</var> よりも大きくなるまで
新しい子プロセスが生成されます。</p>
<p><module>mpm_netware</module> では、
デフォルトは <code>MinSpareThreads 10</code> で、
シングルプロセス MPM ですので、サーバ全体で管理されます。</p>
<p><module>beos</module><module>mpmt_os2</module> は、
<module>mpm_netware</module>によく似ています。
<module>beos</module> でのデフォルトは <code>MinSpareThreads 1</code>
です。<module>mpmt_os2</module> でのデフォルトは
<code>5</code> です。</p>
</usage>
<seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
</directivesynopsis>
<directivesynopsis>
<name>ScoreBoardFile</name>
<description>子プロセスと連携するためのデータを保存する
ファイルの位置</description>
<syntax>ScoreBoardFile <var>file-path</var></syntax>
<default>ScoreBoardFile logs/apache_status</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_winnt</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>
<usage>
<p>Apache は親プロセスと子プロセス間の通信にスコアボードを用います。
この通信機能にファイルを必要とするアーキテクチャもあります。
ファイルが指定されていなければ、Apache はまずメモリ上
(匿名共有メモリ) にスコアボードを作ろうとし、それが失敗すると
ディスク上にファイル (ファイルベースの共有メモリ) を作ろうとします。
このディレクティブを指定すると、Apache
は必ずディスクにファイルを生成します。</p>
<example><title></title>
ScoreBoardFile /var/run/apache_status
</example>
<p>ファイルベースの共有メモリは、サードパーティー製のアプリケーションで
スコアボードに直接アクセスする必要がある場合に役に立ちます。</p>
<p><directive>ScoreBoardFile</directive> を使う場合、
RAM ディスク上に置くとスピードが向上するでしょう。
しかし、ログファイルの設置位置や
<a href="../misc/security_tips.html">セキュリティ</a>
と同様の注意点があるので、注意してください。</p>
</usage>
<seealso><a href="../stopping.html">Apache の停止と再起動</a></seealso>
</directivesynopsis>
<directivesynopsis>
<name>ReceiveBufferSize</name>
<description>TCP 受信バッファサイズ</description>
<syntax>ReceiveBufferSize <var>bytes</var></syntax>
<default>ReceiveBufferSize 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>prefork</module>
<module>worker</module></modulelist>
<usage>
<p>サーバは TCP 受信バッファサイズを指定されたバイト数に設定します。</p>
<p><code>0</code>にした場合、OS のデフォルト値が使用されます。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>SendBufferSize</name>
<description>TCP バッファサイズ</description>
<syntax>SendBufferSize <var>bytes</var></syntax>
<default>SendBufferSize 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>
<usage>
<p>サーバは TCP 送信バッファサイズを指定されたバイト数に設定します。
高速で高レイテンシな環境で
(<em></em> 100ms 程度、大陸横断高速通信路など)
古い一般的な OS のデフォルト値を増やすのに非常に便利です。</p>
<p><code>0</code>にした場合、OS のデフォルト値が使用されます。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ServerLimit</name>
<description>設定可能なサーバプロセス数の上限</description>
<syntax>ServerLimit <var>number</var></syntax>
<default>詳細は使用法を参照</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>
<usage>
<p><module>prefork</module> MPM の場合は、このディレクティブは
Apache プロセス稼働中における
<directive module="mpm_common">MaxClients</directive>
に設定可能な上限値を設定することになります
<transnote>prefork の場合は同時クライアント数 = サーバプロセス数なので</transnote>
<module>worker</module> MPM の場合には、このディレクティブは
<directive module="mpm_common">ThreadLimit</directive>
ディレクティブと組み合わせて、
Apache プロセス稼働中における
<directive module="mpm_common">MaxClients</directive>
に設定可能な上限値を設定することになります。
このディレクティブを変更して再起動<transnote>apachectl
restart</transnote>しても無視されますが、
<directive module="mpm_common">MaxClients</directive>
は再起動で変更することができます。
</p>
<p>このディレクティブを使用する際は特に注意してください。
<directive>ServerLimit</directive> が必要以上に大きな値に
設定された場合は、余計な未使用共有メモリが割り当てられます。
<directive>ServerLimit</directive>
<directive module="mpm_common">MaxClients</directive>
がシステムの扱える範囲を越えた設定値になっていると、
Apache は起動しないか、起動しても不安定になるでしょう。</p>
<p><module>prefork</module> MPM では、
<directive module="mpm_common">MaxClients</directive>
を 256 (デフォルト) よりも大きな値に設定する必要がある時にだけ使用してください。
希望の <directive module="mpm_common">MaxClients</directive>
数とくらべて、必要以上に大きな値を指定することは避けてください。</p>
<p><module>worker</module>, <module>leader</module>,
<module>threadpool</module> MPM では、
<directive module="mpm_common">MaxClients</directive>
<directive module="mpm_common">ThreadsPerChild</directive>
の設定で 16 サーバプロセス (デフォルト)
以上必要になる場合にのみ使用してください。希望の
<directive module="mpm_common">MaxClients </directive>
<directive module="mpm_common">ThreadsPerChild</directive>
とくらべて、必要となるサーバプロセス数以上に大きな値を
設定することは避けてください。</p>
<p><module>perchild</module> MPM では、
<directive module="perchild">NumServers</directive> を 8 (デフォルト)
よろいも大きな値に設定する必要があるときにのみ使用してください。</p>
<note><title>注意</title>
<p><code>ServerLimit 20000</code> という制限付きでコンパイルされています
(<module>prefork</module> MPM では <code>200000</code>) 。
これはスペルミスによって誤って酷い状況になるのを、
回避するための処置です。</p>
</note>
</usage>
<seealso><a href="../stopping.html">Apache の停止と再起動</a></seealso>
</directivesynopsis>
<directivesynopsis>
<name>StartServers</name>
<description>起動時に生成される子サーバプロセスの数</description>
<syntax>StartServers <var>number</var></syntax>
<default>詳細は使用方法を参照</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpmt_os2</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>
<usage>
<p><directive>StartServers</directive> ディレクティブは、
起動時に生成される子サーバプロセスの数を設定します。
プロセス数は負荷に応じて動的に制御されますので、
通常はこの値を調整する理由はあまりないでしょう。</p>
<p>デフォルト値は MPM ごとに異なります。
<module>leader</module>, <module>threadpool</module>,
<module>worker</module><code>StartServers 3</code> です。
<module>prefork</module><code>5</code> で、
<module>mpmt_os2</module><code>2</code> です。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>StartThreads</name>
<description>起動時に生成されるスレッドの数</description>
<syntax>StartThreads <var>number</var></syntax>
<default>詳細は使用方法を参照</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>mpm_netware</module>
<module>perchild</module></modulelist>
<usage>
<p>起動時に生成されるスレッドの数です。
スレッド数は負荷に応じて動的に制御されますので、
通常はこの値を調整する理由はあまりないでしょう。</p>
<p><module>perchild</module> でのデフォルトは
<code>StartThreads 5</code> で、このディレクティブは起動時に
プロセス毎のスレッド数を追跡します。</p>
<p><module>mpm_netware</module> でのデフォルトは
<code>StartThreads 50</code> で、
この場合プロセスは一つしかないので、
起動時にリクエストに応答するスレッドの総数となります。</p>
<p><module>beos</module> でのデフォルトは <code>StartThreads
10</code> です。
また、起動時に生成されるスレッドの総数にも反映されます。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ThreadLimit</name>
<description>設定可能な子プロセス毎のスレッド数の上限を
設定します</description>
<syntax>ThreadLimit <var>number</var></syntax>
<default>詳細は使用方法を参照</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpm_winnt</module>
<module>perchild</module><module>threadpool</module><module>worker</module>
</modulelist>
<compatibility>Apache 2.0.41 とそれ以降の <module>mpm_winnt</module>
で利用可能</compatibility>
<usage>
<p>このディレクティブは
Apache プロセス稼働中における
<directive module="mpm_common">ThreadsPerChild</directive>
に設定可能な上限値を設定します。再起動時にこのディレクティブの値を
変更しても無視されますが、
<directive module="mpm_common">ThreadsPerChild</directive>
は再起動中に、このディレクティブで指定された上限値まで
変更することができます。</p>
<p>このディレクティブを使用する際は特に注意してください。
<directive>ThreadLimit</directive>
<directive module="mpm_common">ThreadsPerChild</directive>
よりもずっと大きな値に設定された場合は、
余計な未使用共有メモリが割り当てられてしまいます。
<directive>ThreadLimit</directive>
<directive module="mpm_common">ThreadsPerChild</directive>
の両方がシステムの扱える範囲を超えている場合は、
Apache は起動しないか、起動したとしても不安定になるでしょう。
このディレクティブの値は今使用している Apache の <directive
module="mpm_common">ThreadsPerChild</directive> の予想上限値を
超えた値には設定しないでください。
</p>
<p><directive>ThreadLimit</directive> のデフォルト値は
<module>mpm_winnt</module> のときは <code>1920</code> で、
他の場合は <code>64</code> です。</p>
<note><title>注意</title>
<p><code>ThreadLimit 20000</code> (<module>mpm_winnt</module>
の場合は <code>ThreadLimit 15000</code> )
という制限付きでコンパイルされています。
これはスペルミスによって誤って酷い状況になるのを、
回避するための処置です。</p>
</note>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ThreadsPerChild</name>
<description>子プロセスそれぞれに生成されるスレッド数</description>
<syntax>ThreadsPerChild <var>number</var></syntax>
<default>詳細は使用方法を参照</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpm_winnt</module>
<module>threadpool</module><module>worker</module></modulelist>
<usage>
<p>このディレクティブは、それぞれの子プロセスで生成される
スレッド数を設定します。
子プロセスは開始時にこれらのスレッドを生成して、
その後は生成しません。<module>mpm_winnt</module> のような、
子プロセスが一つしかないような MPM を利用しているのであれば、
この値はサーバの負荷全体を十分取り扱える程度に、
大きくなければなりません。<module>worker</module> のような、
子プロセスが複数あるような MPM を利用しているのであれば、
サーバの通常負荷を十分扱える程度に、
<em>スレッド総数</em>が多くなければなりません。</p>
<p><module>mpm_winnt</module>での <directive>ThreadsPerChild</directive>
のデフォルト値は <code>64</code> で、他の場合は
<code>25</code> です。</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ThreadStackSize</name>
<description>クライアントのコネクションを受け持つスレッドが使用する
スタックのバイト数</description>
<syntax>ThreadStackSize <var>size</var></syntax>
<default>NetWare では 65536。他の OS では違った値</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpm_netware</module>
<module>mpm_winnt</module><module>perchild</module>
<module>threadpool</module><module>worker</module>
</modulelist>
<compatibility>2.1 以降</compatibility>
<usage>
<p>クライアントコネクションを受け持ち、コネクション処理に必要なモジュールの
呼び出しを行なっているスレッドの、(自動変数用の) スタックサイズは
<directive>ThreadStackSize</directive> ディレクティブで指定します。
大抵の場合 OS の指定しているスタックサイズのデフォルト値は
適切なものですが、調整が必要になる場合もあります:</p>
<ul>
<li>スレッドスタックサイズのデフォルト値が比較的小さく設定されている
プラットホーム (例えば HP-UX) では、自動変数用の領域で大きな容量を
使用するサードパーティ製モジュールのために Apache がクラッシュする
場合もあります。そのモジュールは他のプラットホームでは
スタックサイズが大きいために、快調に動作するかもしれません。
このタイプのクラッシュは、<directive>ThreadStackSize</directive>
で OS のデフォルト値より大きな値を指定することで解決します。
サードパーティ製モジュールでこの処置が必要であると記載されている
場合か、Apache の出力するメッセージでスレッドスタックサイズが
小さすぎると指摘されている場合にのみ、この調整をしてください。</li>
<li>デフォルトスレッドスタックサイズが、Web サーバ用途に必要な量よりも
明らかに大きすぎる場合、<directive>ThreadStackSize</directive>
を OS のデフォルト値よりも小さな値にすることで、子プロセスあたりの
スレッド数をより多く持たせられるようになります。
このタイプの調整は、テスト環境でウェブサーバを完全に
テストできる場合に限って行なうべきです。
まれに多数のスタックが要求されるリクエストを受けることがあるかも
しれないからです。
Web サーバの設定を変更すると、現在の <directive>ThreadStackSize</directive>
の設定が取り消される場合があります。</li>
</ul>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>User</name>
<description>リクエストに応答する際に用いるユーザ ID</description>
<syntax>User <var>unix-userid</var></syntax>
<default>User #-1</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>
<compatibility>Apache 2.0 以降で、グローバル設定でのみ有効です。
</compatibility>
<usage>
<p><directive>User</directive> ディレクティブは
サーバがリクエストに応答する際に用いるユーザ ID を設定します。
このディレクティブを使用するためには、スタンドアロン型の
サーバは最初に <code>root</code> 権限で起動されている必要があります。
非 root ユーザでサーバを起動した場合は、
権限の低いユーザへと変わることができず、
結局元のユーザのプロセスとして実行され続けます。
<code>root</code> で起動した場合に親プロセスが root
として実行されているのは正常な動作です。
<var>Unix-userid</var> は次のどれかです。</p>
<dl>
<dt>ユーザ名</dt>
<dd>ユーザを名前で参照します。</dd>
<dt># に続いてユーザ番号</dt>
<dd>ユーザを番号で参照します。</dd>
</dl>
<p>このユーザは、外部に見せるように意図していないファイルに、
アクセス可能になってしまうような権限を持つべきではないですし、
同様に HTTP リクエストに対して応答するように意図していない
実行コードを、実行できるような権限を持つべきではないです。
サーバを実行するために特定の新しいユーザとグループを
設定することをお薦めいたします。
<code>nobody</code> ユーザを使用する管理者もいますが、
これが常に望ましいわけではありません。
なぜなら <code>nobody</code> ユーザは、システムで
他の役割を担っているかも知れないからです。</p>
<note type="warning"><title>セキュリティ</title>
<p>正確にどんなことをやっているのか、その危険性を知らないで、
<directive>User</directive> (や <directive
module="mpm_common">Group</directive>) を <code>root</code>
設定しないでください。</p>
</note>
<p><module>perchild</module> MPM では、異なるユーザ ID
で複数のバーチャルホストを動かすことを目的としていますが、
<directive>User</directive> は、主サーバのユーザ ID
と、<directive module="perchild">AssignUserID</directive>
ディレクティブを持たない <directive type="section"
module="core">VirtualHost</directive> セクションへの
フォールバックとを定義することになります。</p>
<p>特記事項: このディレクティブを
<directive module="core" type="section">VirtualHost</directive>
で使用することはサポートされなくなりました。
<program>suexec</program> 向けにサーバを設定するのであれば、
<directive module="mod_suexec">SuexecUserGroup</directive>
を使用してください。</p>
<note><title>注意</title>
<p><directive>User</directive> ディレクティブは
<module>beos</module><module>mpmt_os2</module> MPM
にも存在しますが、実質的に無効で、互換性のためだけに存在します。</p>
</note>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ChrootDir</name>
<description>apache が起動後に chroot(8) するディレクトリ
</description>
<syntax>ChrootDir <var>/path/to/directory</var></syntax>
<default>none</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module>
<module>prefork</module><module>worker</module></modulelist>
<usage>
<p>このディレクティブは2.2.9(?)以降で利用できます。
サーバ起動後、ネットからリクエストを受け付けるより前に、
サーバは指定したディレクトリに <var>chroot(8)</var> します。</p>
<p>chroot 環境下でサーバを動かすのは単純ではなく、
特に CGI や PHP を動かしているなら、さらなるセットアップ
が必要であることに注意してください。 この機能を使おうとする前に、
chroot の動作を正しく理解しておくようにしてください。</p>
</usage>
</directivesynopsis>
</modulesynopsis>