| <?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: 659902:1673563 (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="ip-based.xml.meta"> |
| <parentdocument href="./">バーチャルホスト</parentdocument> |
| <title>Apache の IP ベースのバーチャルホストサポート</title> |
| |
| <seealso> |
| <a href="name-based.html">名前ベースのバーチャルホストサポート</a> |
| </seealso> |
| |
| <section id="requirements"><title>システム要件</title> |
| |
| <p><cite>IP ベース</cite> という名前が示すように、サーバには |
| <strong>IP ベースのバーチャルホストそれぞれにつき、別々の IP アドレスが |
| 必要です</strong>。複数の物理コネクションを持っているマシンを用意するか、 |
| 最近のオペレーティングシステムでサポートされているバーチャル |
| インタフェース (詳細はシステムの説明書を読んでください。たいていは |
| "ip エイリアス" と呼ばれていて、設定には普通 "ifconfig" コマンドを |
| 使います) を使うかで実現できます。</p> |
| </section> |
| |
| <section id="howto"><title>Apache の設定方法</title> |
| |
| <p>複数のホストをサポートするように Apache を設定する方法は |
| 二通りあります。別の <program>httpd</program> デーモンを各ホスト毎に実行するか、 |
| すべてのバーチャルホストをサポートするデーモンを一つ実行するかです。</p> |
| |
| <p>以下のときには複数のデーモンを使うと良いでしょう:</p> |
| |
| <ul> |
| <li>会社1 はウェブ経由以外では会社2 からはデータを読まれたくない、 |
| といったセキュリティの分離の問題があるとき。この場合、それぞれ |
| <directive |
| module="mpm_common">User</directive>, <directive |
| module="mpm_common">Group</directive>, <directive |
| module="mpm_common">Listen</directive>, <directive |
| module="core">ServerRoot</directive> の設定が違う二つのデーモンを |
| 実行する必要があります。</li> |
| |
| <li>マシンのすべての IP エイリアスを listen するだけの |
| メモリとファイル記述子の余裕があるとき。<directive |
| module="mpm_common">Listen</directive> は「ワイルドカード」 |
| アドレスか、特定のアドレスのみを listen することができます。 |
| ですから、何らかの理由で特定のアドレスを listen しなけばならない |
| ときは、その特定のアドレスをすべて listen する必要があります。 |
| (ただし、一つの <program>httpd</program> が N-1 個のアドレスを listen し、 |
| 別の <program>httpd</program> が残りのアドレスを listen するといったことは可能です。)</li> |
| </ul> |
| |
| <p>以下のときには単独のデーモンを使うと良いでしょう:</p> |
| |
| <ul> |
| <li>バーチャルホスト間での httpd の設定を共有してもよいとき。</li> |
| |
| <li>マシンが多くのリクエストを扱うため、別デーモンを実行することによる |
| 性能の低下の影響が著しいとき。</li> |
| </ul> |
| |
| </section> |
| |
| <section id="multiple"><title>複数デーモンの設定</title> |
| |
| <p>各バーチャルホストに対して別の <program>httpd</program> のインストールを行ないます。 |
| 設定ファイル中の <directive module="mpm_common">Listen</directive> |
| ディレクティブを使って、 |
| 各インストールでデーモンが扱う IP アドレス (バーチャルホスト) |
| を選択します。例えば</p> |
| |
| <example> |
| Listen www.smallco.com:80 |
| </example> |
| |
| <p>ここで、ホスト名の代わりに IP アドレスを使う方が推奨されていることに |
| 注意しておいてください |
| (<a href="../dns-caveats.html">DNS の注意事項</a> 参照)。</p> |
| |
| </section> |
| |
| <section id="single"><title>複数のバーチャルホストの設定をした |
| デーモンを一つ設定する</title> |
| |
| <p>この場合は、一つの <program>httpd</program> が主サーバとすべてのバーチャルホストのリクエストを |
| 処理します。設定ファイルの <directive |
| module="core">VirtualHost</directive> ディレクティブを使って、 |
| <directive |
| module="core">ServerAdmin</directive>, <directive |
| module="core">ServerName</directive>, <directive |
| module="core">DocumentRoot</directive>, <directive |
| module="core">ErrorLog</directive>, <directive |
| module="mod_log_config">TransferLog</directive> |
| や <directive module="mod_log_config">CustomLog</directive> |
| 設定ディレクティブの値が各ホスト毎に異なる値に設定されるようにします。 |
| 例えば</p> |
| |
| <example> |
| <VirtualHost www.smallco.com><br /> |
| ServerAdmin webmaster@mail.smallco.com<br /> |
| DocumentRoot /groups/smallco/www<br /> |
| ServerName www.smallco.com<br /> |
| ErrorLog /groups/smallco/logs/error_log<br /> |
| TransferLog /groups/smallco/logs/access_log<br /> |
| </VirtualHost><br /> |
| <br /> |
| <VirtualHost www.baygroup.org><br /> |
| ServerAdmin webmaster@mail.baygroup.org<br /> |
| DocumentRoot /groups/baygroup/www<br /> |
| ServerName www.baygroup.org<br /> |
| ErrorLog /groups/baygroup/logs/error_log<br /> |
| TransferLog /groups/baygroup/logs/access_log<br /> |
| </VirtualHost> |
| </example> |
| |
| <p>ここで、ホスト名の代わりに IP アドレスを使う方が推奨されていることに |
| 注意しておいてください |
| (<a href="../dns-caveats.html">DNS の注意事項</a> 参照)。</p> |
| |
| <p>プロセス生成を制御するディレクティブやその他のいくつかのディレクティブを |
| 除いて、ほぼ<strong>すべて</strong>の設定ディレクティブを VirtualHost |
| ディレクティブの中に書くことができます。ディレクティブが VirtualHost |
| ディレクティブで使用できるかどうかは <a href="../mod/directives.html" |
| >ディレクティブ索引</a>を使って<a |
| href="../mod/directive-dict.html#Context">コンテキスト</a>の |
| 欄を調べてください。</p> |
| |
| <p><a href="../suexec.html">suEXECラッパー</a>を使っている場合は、 |
| <directive module="mod_suexec">SuexecUserGroup</directive> |
| ディレクティブを VirtualHost |
| ディレクティブの中で使用することができます。</p> |
| |
| <p><em>セキュリティ:</em> ログファイルを書く場所を指定するときは、 |
| Apache を起動したユーザ以外がそのディレクトリに書き込み権限を |
| 持っている場合にセキュリティ上の危険があることに注意してください。 |
| 詳細は<a |
| href="../misc/security_tips.html">セキュリティのこつ</a>ドキュメントを |
| 参照してください。</p> |
| |
| </section> |
| </manualpage> |