| <?xml version='1.0' encoding='UTF-8' ?> | |
| <!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd"> | |
| <?xml-stylesheet type="text/xsl" href="./style/manual.ja.xsl"?> | |
| <!-- English Revision: 1816110:1933438 (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. | |
| --> | |
| <manualpage metafile="bind.xml.meta"> | |
| <title>アドレスとポートのバインド</title> | |
| <summary> | |
| <p>特定のアドレスとポートで待ち受けるための Apache HTTP Server の設定。</p> | |
| </summary> | |
| <seealso><a href="vhosts/">バーチャルホスト</a></seealso> | |
| <seealso><a href="dns-caveats.html">DNS の問題</a></seealso> | |
| <section id="overview"> | |
| <title>概要</title> | |
| <related> | |
| <modulelist> | |
| <module>core</module> | |
| <module>mpm_common</module> | |
| </modulelist> | |
| <directivelist> | |
| <directive module="core" type="section">VirtualHost</directive> | |
| <directive module="mpm_common">Listen</directive> | |
| </directivelist> | |
| </related> | |
| <p>httpd は起動時に、ローカルマシンのあるポートとアドレスに対して | |
| バインドし、リクエストが来るのを待ちます。デフォルトでは | |
| マシンのすべてのアドレスで待ち受けます。しかし、特定のポートのみ、 | |
| または選択したアドレスのみ、あるいはその両方の組み合わせで | |
| 待ち受けるように指定する必要がある場合もあります。これは多くの場合、 | |
| <code>httpd</code> が異なる IP アドレス、ホスト名、ポートに対して | |
| どのように応答するかを決定する<a href="vhosts/">バーチャルホスト</a> | |
| 機能と組み合わせて使用されます。</p> | |
| <p><directive module="mpm_common">Listen</directive> | |
| ディレクティブは、指定されたポートまたは | |
| アドレスとポートの組み合わせでのみ受信リクエストを | |
| 受け付けるようサーバに指示します。 | |
| <directive module="mpm_common">Listen</directive> | |
| ディレクティブでポート番号のみが指定された場合、 | |
| サーバはすべてのインターフェースの指定されたポートで待ち受けます。 | |
| IP アドレスとポートが同時に指定された場合は、 | |
| サーバは指定されたポートとインターフェースで待ち受けます。 | |
| 複数の <directive module="mpm_common">Listen</directive> | |
| ディレクティブを使って、待ち受けるアドレスとポートを | |
| 複数指定することができます。 | |
| サーバは指定されたアドレスとポートのいずれかからの | |
| リクエストに応答します。</p> | |
| <p>たとえば、すべてのインターフェースのポート 80 と | |
| ポート 8000 の両方で接続を受け付けるには、次のようにします:</p> | |
| <example> | |
| <highlight language="config"> | |
| Listen 80 | |
| Listen 8000 | |
| </highlight> | |
| </example> | |
| <p>あるインターフェースではポート 80 で、別のインターフェースでは | |
| ポート 8000 で接続を受け付けるには、次のようにします</p> | |
| <example> | |
| <highlight language="config"> | |
| Listen 192.0.2.1:80 | |
| Listen 192.0.2.5:8000 | |
| </highlight> | |
| </example> | |
| <p>IPv6 アドレスは、次の例のように角括弧で囲む必要があります:</p> | |
| <example> | |
| <highlight language="config"> | |
| Listen [2001:db8::a00:20ff:fea7:ccea]:80 | |
| </highlight> | |
| </example> | |
| <note type="warning"><p><directive | |
| module="mpm_common">Listen</directive> ディレクティブが重複すると、 | |
| サーバの起動を妨げる致命的なエラーが発生します。</p> | |
| <example> | |
| (48)Address already in use: make_sock: could not bind to address [::]:80 | |
| </example> | |
| <p>さらなるトラブルシューティングのヒントについては、 | |
| <a href="https://cwiki.apache.org/confluence/display/httpd/CouldNotBindToAddress">wiki | |
| での議論</a>を参照してください。</p> | |
| </note> | |
| </section> | |
| <section id="reload"> | |
| <title>再起動時の Listen 設定の変更</title> | |
| <p>httpd を再起動する際には、<directive module="mpm_common">Listen</directive> | |
| ディレクティブの変更に対して特別な配慮が必要です。再起動中、httpd は | |
| サーバへの新しい接続試行に対する「Connection refused」エラーを | |
| 避けるために、(元の設定のまま)ポートをバインドしたままにします。 | |
| 使用中の <directive module="mpm_common">Listen</directive> | |
| ディレクティブのセットに対して古い設定と競合する変更が行われた場合、 | |
| 設定は失敗しサーバは終了します。</p> | |
| <p>たとえば、次の設定から:</p> | |
| <example> | |
| <highlight language="config"> | |
| Listen 127.0.0.1:80 | |
| </highlight> | |
| </example> | |
| <p>次の設定に変更すると失敗する可能性があります。なぜなら、 | |
| すべてのアドレスのポート 80 へのバインドは、 | |
| 127.0.0.1 のみのポート 80 へのバインドと競合するからです。</p> | |
| <example> | |
| <highlight language="config"> | |
| Listen 80 | |
| </highlight> | |
| </example> | |
| <p>このような設定変更を有効にするには、 | |
| サーバを停止してから起動する必要があります。</p> | |
| </section> | |
| <section id="ipv6"> | |
| <title>IPv6 の特記事項</title> | |
| <p>多くのプラットフォームで IPv6 が実装されてきており、 | |
| <glossary>APR</glossary> はこれらのほとんどで IPv6 をサポートしているので、 | |
| httpd は IPv6 ソケットを割り当てて IPv6 | |
| 経由で送られてきたリクエストを処理することができます。</p> | |
| <p>httpd 管理者にとって厄介な問題の一つは、IPv6 ソケットが | |
| IPv4 と IPv6 の両方のコネクションを処理できるかどうかです。 | |
| IPv6 ソケットでの IPv4 コネクションの処理には | |
| IPv4 マップド IPv6 アドレスが使用されますが、 | |
| これはほとんどのプラットフォームではデフォルトで許可されていますが、 | |
| FreeBSD、NetBSD、OpenBSD では、これらのプラットフォームの | |
| システム全体のポリシーに合わせるため、 | |
| デフォルトでは無効になっています。 | |
| デフォルトで無効になっているシステムでも、 | |
| 特別な <program>configure</program> パラメータで | |
| httpd のこの動作を変更できます。</p> | |
| <p>一方、Linux や Tru64 などのプラットフォームでは、 | |
| IPv6 と IPv4 の両方を処理する<strong>唯一の</strong>方法は | |
| マップドアドレスを使用することです。 | |
| IPv4 マップド IPv6 アドレスの使用を必要とする | |
| 最小限のソケットで <code>httpd</code> に IPv4 と IPv6 のコネクションを | |
| 処理させたい場合は、<code>--enable-v4-mapped</code> <program>configure</program> | |
| オプションを指定してください。</p> | |
| <p><code>--enable-v4-mapped</code> は FreeBSD、NetBSD、OpenBSD を除く | |
| すべてのプラットフォームでのデフォルトですので、 | |
| おそらくお手元の httpd はこの設定でビルドされているでしょう。</p> | |
| <p>プラットフォームや APR が何をサポートするかに関わらず、 | |
| httpd に IPv4 コネクションのみを処理させたい場合は、 | |
| 次の例のようにすべての | |
| <directive module="mpm_common">Listen</directive> ディレクティブで | |
| IPv4 アドレスを指定してください:</p> | |
| <example> | |
| <highlight language="config"> | |
| Listen 0.0.0.0:80 | |
| Listen 192.0.2.1:80 | |
| </highlight> | |
| </example> | |
| <p>プラットフォームがサポートしており、httpd に IPv4 と | |
| IPv6 のコネクションを別々のソケットで処理させたい場合 | |
| (つまり IPv4 マップドアドレスを無効にしたい場合)は、 | |
| <code>--disable-v4-mapped</code> <program>configure</program> | |
| オプションを指定してください。<code>--disable-v4-mapped</code> は | |
| FreeBSD、NetBSD、OpenBSD でのデフォルトです。</p> | |
| </section> | |
| <section id="protocol"> | |
| <title>Listen でプロトコルを指定する</title> | |
| <p><directive module="mpm_common">Listen</directive> の | |
| オプションの第二引数 <var>protocol</var> は、 | |
| ほとんどの設定では必要ありません。 | |
| 指定しない場合、ポート 443 では <code>https</code> が、 | |
| その他すべてのポートでは <code>http</code> がデフォルトになります。 | |
| プロトコルは、どのモジュールがリクエストを処理すべきかを決定し、 | |
| <directive module="core">AcceptFilter</directive> | |
| ディレクティブでプロトコル固有の最適化を適用するために使用されます。</p> | |
| <p>非標準のポートで実行している場合にのみ、プロトコルを設定する | |
| 必要があります。たとえば、ポート 8443 で <code>https</code> | |
| サイトを実行する場合:</p> | |
| <example> | |
| <highlight language="config"> | |
| Listen 192.170.2.1:8443 https | |
| </highlight> | |
| </example> | |
| </section> | |
| <section id="virtualhost"> | |
| <title>バーチャルホストとの連携</title> | |
| <p><directive module="mpm_common">Listen</directive> | |
| ディレクティブはバーチャルホストを実装するものではありません。 | |
| メインサーバにどのアドレスとポートで待ち受けるかを指示するだけです。 | |
| <directive module="core" type="section">VirtualHost</directive> | |
| ディレクティブが使われない場合、サーバは受け付けたすべてのリクエストに | |
| 対して同じように振る舞います。しかし、 | |
| <directive module="core" type="section">VirtualHost</directive> | |
| を使って、一つ以上のアドレスやポートに対して | |
| 異なる振る舞いを指定することができます。 | |
| VirtualHost を実装するには、まず使用するアドレスとポートで | |
| サーバが待ち受けている必要があります。 | |
| そして、指定したアドレスとポートでのバーチャルホストの振る舞いを | |
| 設定するために | |
| <directive module="core" type="section">VirtualHost</directive> | |
| セクションを作成します。 | |
| サーバが待ち受けていないアドレスとポートに対して | |
| <directive module="core" type="section">VirtualHost</directive> | |
| が設定された場合、そのバーチャルホストにはアクセスできないことに | |
| 注意してください。</p> | |
| </section> | |
| </manualpage> |