6ae232055d4d8a97267517c5e50074c2c819941and<?xml version="1.0" encoding="UTF-8"?>
6ae232055d4d8a97267517c5e50074c2c819941and<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"><head>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<!--
6ae232055d4d8a97267517c5e50074c2c819941and XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
6ae232055d4d8a97267517c5e50074c2c819941and This file is generated from xml source: DO NOT EDIT
6ae232055d4d8a97267517c5e50074c2c819941and XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
6ae232055d4d8a97267517c5e50074c2c819941and -->
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc<title>名前ベースのバーチャルホスト - Apache HTTP サーバ バージョン 2.5</title>
6ae232055d4d8a97267517c5e50074c2c819941and<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
6ae232055d4d8a97267517c5e50074c2c819941and<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
2e545ce2450a9953665f701bb05350f0d3f26275nd<script src="/style/scripts/prettify.min.js" type="text/javascript">
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen</script>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
6ae232055d4d8a97267517c5e50074c2c819941and<link href="/images/favicon.ico" rel="shortcut icon" /></head>
6ae232055d4d8a97267517c5e50074c2c819941and<body id="manual-page"><div id="page-header">
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">モジュール</a> | <a href="/mod/quickreference.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">用語</a> | <a href="/sitemap.html">サイトマップ</a></p>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<p class="apache">Apache HTTP サーバ バージョン 2.5</p>
6ae232055d4d8a97267517c5e50074c2c819941and<img alt="" src="/images/feather.gif" /></div>
6ae232055d4d8a97267517c5e50074c2c819941and<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
6ae232055d4d8a97267517c5e50074c2c819941and<div id="path">
b43f840409794ed298e8634f6284741f193b6c4ftakashi<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP サーバ</a> &gt; <a href="http://httpd.apache.org/docs/">ドキュメンテーション</a> &gt; <a href="../">バージョン 2.5</a> &gt; <a href="./">バーチャルホスト</a></div><div id="page-content"><div id="preamble"><h1>名前ベースのバーチャルホスト</h1>
6ae232055d4d8a97267517c5e50074c2c819941and<div class="toplang">
b43f840409794ed298e8634f6284741f193b6c4ftakashi<p><span>翻訳済み言語: </span><a href="/de/vhosts/name-based.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
6ae232055d4d8a97267517c5e50074c2c819941and<a href="/en/vhosts/name-based.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
6ae232055d4d8a97267517c5e50074c2c819941and<a href="/fr/vhosts/name-based.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
6ae232055d4d8a97267517c5e50074c2c819941and<a href="/ja/vhosts/name-based.html" title="Japanese">&nbsp;ja&nbsp;</a> |
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<a href="/ko/vhosts/name-based.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/tr/vhosts/name-based.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
6ae232055d4d8a97267517c5e50074c2c819941and</div>
b43f840409794ed298e8634f6284741f193b6c4ftakashi<div class="outofdate">この日本語訳はすでに古くなっている
b43f840409794ed298e8634f6284741f193b6c4ftakashi 可能性があります。
b43f840409794ed298e8634f6284741f193b6c4ftakashi 最近更新された内容を見るには英語版をご覧下さい。
b43f840409794ed298e8634f6284741f193b6c4ftakashi </div>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>この文書では名前ベースのバーチャルホストをどんなとき、
6ae232055d4d8a97267517c5e50074c2c819941and どうやって使うかを説明します。</p>
6ae232055d4d8a97267517c5e50074c2c819941and</div>
6ae232055d4d8a97267517c5e50074c2c819941and<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#namevip">名前ベースと IP ベースのバーチャルホストの比較</a></li>
6ae232055d4d8a97267517c5e50074c2c819941and<li><img alt="" src="/images/down.gif" /> <a href="#using">名前ベースのバーチャルホストを利用する</a></li>
6ae232055d4d8a97267517c5e50074c2c819941and<li><img alt="" src="/images/down.gif" /> <a href="#compat">古いブラウザとの互換性</a></li>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh</ul><h3>参照</h3><ul class="seealso"><li><a href="ip-based.html">ネームベースのバーチャルホスト</a></li><li><a href="details.html">バーチャルホストのマッチングについての詳細</a></li><li><a href="mass.html">大量のバーチャルホストの動的な設定</a></li><li><a href="examples.html">バーチャルホストの一般的な設定例</a></li><li><a href="examples.html#serverpath">ServerPath 設定例</a></li></ul><ul class="seealso"><li><a href="#comments_section">コメント</a></li></ul></div>
6ae232055d4d8a97267517c5e50074c2c819941and<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6ae232055d4d8a97267517c5e50074c2c819941and<div class="section">
6ae232055d4d8a97267517c5e50074c2c819941and<h2><a name="namevip" id="namevip">名前ベースと IP ベースのバーチャルホストの比較</a></h2>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>IP ベースのバーチャルホストでは、応答する
6ae232055d4d8a97267517c5e50074c2c819941and バーチャルホストへのコネクションを決定するために IP
6ae232055d4d8a97267517c5e50074c2c819941and アドレスを使用します。ですから、それぞれのホストに個々に IP
6ae232055d4d8a97267517c5e50074c2c819941and アドレスが必要になります。これに対して名前ベースのバーチャルホストでは、
6ae232055d4d8a97267517c5e50074c2c819941and クライアントが HTTP ヘッダの一部としてホスト名を告げる、
6ae232055d4d8a97267517c5e50074c2c819941and ということに依存します。この技術で同一 IP
6ae232055d4d8a97267517c5e50074c2c819941and アドレスを異なる多数のホストで共有しています。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>名前ベースのバーチャルホストは通常単純で、それぞれのホスト名と
6ae232055d4d8a97267517c5e50074c2c819941and それに対応する正確な IP アドレスを DNS で設定し、異なる
6ae232055d4d8a97267517c5e50074c2c819941and ホスト名を区別するように Apache HTTP サーバを設定するだけです。
6ae232055d4d8a97267517c5e50074c2c819941and さらに、名前ベースのバーチャルホストは不足する IP
6ae232055d4d8a97267517c5e50074c2c819941and アドレスの需要を緩和します。したがって、IP ベースのバーチャルホストを
6ae232055d4d8a97267517c5e50074c2c819941and 選択すべき特定の理由がなければ名前ベースのバーチャルホストを使うべきです。
6ae232055d4d8a97267517c5e50074c2c819941and IP ベースのバーチャルホストを使用することを考慮する理由として、</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <ul>
6ae232055d4d8a97267517c5e50074c2c819941and <li>名前ベースのバーチャルホストに対応していない古いクライアントがある
6ae232055d4d8a97267517c5e50074c2c819941and 名前ベースのバーチャルホストが働くためには、クライアントは
6ae232055d4d8a97267517c5e50074c2c819941and HTTP ホストヘッダを送ってこなければなりません。
6ae232055d4d8a97267517c5e50074c2c819941and これは HTTP/1.1 の仕様で要求されていて、すべての現代的な
6ae232055d4d8a97267517c5e50074c2c819941and HTTP/1.0 ブラウザでも拡張として実装されています。
6ae232055d4d8a97267517c5e50074c2c819941and とても古いクライアントをサポートしつつ、名前ベースの
6ae232055d4d8a97267517c5e50074c2c819941and バーチャルホストを行いたい場合は、この文書の最後の方に
6ae232055d4d8a97267517c5e50074c2c819941and 書かれている解決策になるかもしれない方法を見てください。</li>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <li>名前ベースのバーチャルホストは SSL プロトコルの特徴により、
6ae232055d4d8a97267517c5e50074c2c819941and SSL セキュアサーバには使えません。</li>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <li>オペレーティングシステムやネットワーク装置のなかには、
6ae232055d4d8a97267517c5e50074c2c819941and 別の IP アドレス上でない場合、複数のホストを別扱いできないような
6ae232055d4d8a97267517c5e50074c2c819941and 帯域管理の方法を実装しているものがあります。</li>
6ae232055d4d8a97267517c5e50074c2c819941and </ul>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6ae232055d4d8a97267517c5e50074c2c819941and<div class="section">
6ae232055d4d8a97267517c5e50074c2c819941and<h2><a name="using" id="using">名前ベースのバーチャルホストを利用する</a></h2>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and<table class="related"><tr><th>関連モジュール</th><th>関連ディレクティブ</th></tr><tr><td><ul><li><code class="module"><a href="/mod/core.html">core</a></code></li></ul></td><td><ul><li><code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code></li><li><code class="directive"><a href="/mod/core.html#namevirtualhost">NameVirtualHost</a></code></li><li><code class="directive"><a href="/mod/core.html#serveralias">ServerAlias</a></code></li><li><code class="directive"><a href="/mod/core.html#servername">ServerName</a></code></li><li><code class="directive"><a href="/mod/core.html#serverpath">ServerPath</a></code></li><li><code class="directive"><a href="/mod/core.html#virtualhost">VirtualHost</a></code></li><li><code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code></li></ul></td></tr></table>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>名前ベースのバーチャルホストを使うには、そのホストへの
6ae232055d4d8a97267517c5e50074c2c819941and リクエストを受け付けるサーバの IP アドレス (もしかしたらポートも)
6ae232055d4d8a97267517c5e50074c2c819941and を指定する必要があります。
6ae232055d4d8a97267517c5e50074c2c819941and これは <code class="directive"><a href="/mod/core.html#namevirtualhost">NameVirtualHost</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and ディレクティブで設定します。通常、<code class="directive"><a href="/mod/core.html#namevirtualhost">NameVirtualHost</a></code> で
6ae232055d4d8a97267517c5e50074c2c819941and <code>*</code> の属性を使ってサーバの全ての IP アドレスを使います。
6ae232055d4d8a97267517c5e50074c2c819941and (例えば SSL の使用などで) 複数のポートを使うことを計画しているのであれば、
6ae232055d4d8a97267517c5e50074c2c819941and 引数に <code>*:80</code> のようにポートも含めるようにしてください。
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#namevirtualhost">NameVirtualHost</a></code> ディレクティブで
6ae232055d4d8a97267517c5e50074c2c819941and IP アドレスを書いても、
6ae232055d4d8a97267517c5e50074c2c819941and 自動的にサーバがその IP アドレスをリッスンするということはないことに
6ae232055d4d8a97267517c5e50074c2c819941and 注意してください。詳細は「<a href="/bind.html">Apache の使うアドレスと
6ae232055d4d8a97267517c5e50074c2c819941and ポートを設定する</a>」を読んでください。さらに、ここで指定された
6ae232055d4d8a97267517c5e50074c2c819941and IP アドレスは全てサーバのネットワークインターフェースと関連付けられて
6ae232055d4d8a97267517c5e50074c2c819941and いなければなりません。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>次は、扱うホストそれぞれに対して <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> ブロックを
6ae232055d4d8a97267517c5e50074c2c819941and 作成してください。<code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and ディレクティブの引数は <code class="directive"><a href="/mod/core.html#namevirtualhost">NameVirtualHost</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and ディレクティブの引数と同じにしてください (すなわち、IP アドレスか、全てのアドレスを意味する
6ae232055d4d8a97267517c5e50074c2c819941and <code>*</code>)。それぞれの <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and ディレクティブの中には、最低限、どのホストが扱われるかを示す <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code> ディレクティブと、
6ae232055d4d8a97267517c5e50074c2c819941and そのホスト用のコンテンツがファイルシステム上のどこにあるかを示す
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code> ディレクティブを
6ae232055d4d8a97267517c5e50074c2c819941and 書く必要があります。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <div class="note"><h3>メインホストはなくなります</h3>
6ae232055d4d8a97267517c5e50074c2c819941and <p>既にあるウェブサーバにバーチャルホストを追加する場合、
6ae232055d4d8a97267517c5e50074c2c819941and 既存のウェブサーバに対しても <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and ブロックを作らなければなりません。このバーチャルホストの
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code> と
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and は、グローバルな <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code> と
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and と同じものにします。また、このバーチャルホストを設定ファイルの中で
6ae232055d4d8a97267517c5e50074c2c819941and 先頭に置いて、デフォルトホストとして動作するようにします。</p>
6ae232055d4d8a97267517c5e50074c2c819941and </div>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>たとえば、<code>www.domain.tld</code> を動かしていて、
6ae232055d4d8a97267517c5e50074c2c819941and さらにバーチャルホスト <code>www.otherdomain.tld</code>
6ae232055d4d8a97267517c5e50074c2c819941and を追加するとしましょう。このバーチャルホストは同一 IP を指しているとします。
6ae232055d4d8a97267517c5e50074c2c819941and そのような場合は、<code>httpd.conf</code>
6ae232055d4d8a97267517c5e50074c2c819941and に以下のようなコードを追加するだけです</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <div class="example"><p><code>
6ae232055d4d8a97267517c5e50074c2c819941and NameVirtualHost *:80<br />
6ae232055d4d8a97267517c5e50074c2c819941and <br />
6ae232055d4d8a97267517c5e50074c2c819941and &lt;VirtualHost *:80&gt;<br />
6ae232055d4d8a97267517c5e50074c2c819941and <span class="indent">
6ae232055d4d8a97267517c5e50074c2c819941and ServerName www.domain.tld<br />
6ae232055d4d8a97267517c5e50074c2c819941and ServerAlias domain.tld *.domain.tld<br />
6ae232055d4d8a97267517c5e50074c2c819941and DocumentRoot /www/domain<br />
6ae232055d4d8a97267517c5e50074c2c819941and </span>
6ae232055d4d8a97267517c5e50074c2c819941and &lt;/VirtualHost&gt;<br />
6ae232055d4d8a97267517c5e50074c2c819941and <br />
6ae232055d4d8a97267517c5e50074c2c819941and &lt;VirtualHost *:80&gt;<br />
6ae232055d4d8a97267517c5e50074c2c819941and <span class="indent">ServerName www.otherdomain.tld<br />
6ae232055d4d8a97267517c5e50074c2c819941and DocumentRoot /www/otherdomain<br />
6ae232055d4d8a97267517c5e50074c2c819941and </span>
6ae232055d4d8a97267517c5e50074c2c819941and &lt;/VirtualHost&gt;<br />
6ae232055d4d8a97267517c5e50074c2c819941and </code></p></div>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p><code class="directive"><a href="/mod/core.html#namevirtualhost">NameVirtualHost</a></code> 及び
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#virtualhost">VirtualHost</a></code> のどちらの場合も、
6ae232055d4d8a97267517c5e50074c2c819941and * の部分には明示的に IP アドレスを指定することができます。
6ae232055d4d8a97267517c5e50074c2c819941and 例えば、ある IP アドレスでは名前ベースのバーチャルホストを使いたい一方で、
6ae232055d4d8a97267517c5e50074c2c819941and 別の IP アドレスでは、他の IP ベースのバーチャルホストや
6ae232055d4d8a97267517c5e50074c2c819941and 別組の名前ベースのバーチャルホストを使いたい場合、
6ae232055d4d8a97267517c5e50074c2c819941and そう設定することになるでしょう。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>複数の名前でサーバアクセスができるようにしたいことも多いでしょう。
6ae232055d4d8a97267517c5e50074c2c819941and このようなことは、<code class="directive"><a href="/mod/core.html#serveralias">ServerAlias</a></code> ディレクティブを <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and セクションに記述することで実現できます。
6ae232055d4d8a97267517c5e50074c2c819941and 例えば上記の <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> の例であれば、
6ae232055d4d8a97267517c5e50074c2c819941and 次のように一覧に挙げられた名前が、
6ae232055d4d8a97267517c5e50074c2c819941and ユーザが同一のウェブサイトとして目にして使用できるサーバ名である、
6ae232055d4d8a97267517c5e50074c2c819941and と <code class="directive"><a href="/mod/core.html#serveralias">ServerAlias</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and ディレクティブで指定できます。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <div class="example"><p><code>
6ae232055d4d8a97267517c5e50074c2c819941and ServerAlias domain.tld *.domain.tld
6ae232055d4d8a97267517c5e50074c2c819941and </code></p></div>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p><code>domain.tld</code> ドメインへの全てのホストへのリクエストは
6ae232055d4d8a97267517c5e50074c2c819941and <code>www.domain.tld</code> のバーチャルホストが処理します。
6ae232055d4d8a97267517c5e50074c2c819941and 名前をマッチさせるために、ワイルドカード文字 * や ?
6ae232055d4d8a97267517c5e50074c2c819941and を使用することもできます。もちろん思いつきの名前を作って、
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code> や
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#serveralias">ServerAlias</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and にその名前を書くといったことはできません。まずは、
6ae232055d4d8a97267517c5e50074c2c819941and これらの名前が サーバに付けられた IP アドレスにマップされるように
6ae232055d4d8a97267517c5e50074c2c819941and DNS サーバを適切に設定しなければなりません。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>最後に、<code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> コンテナの中に
6ae232055d4d8a97267517c5e50074c2c819941and 他のディレクティブを書くことで、バーチャルホストの設定を細かく調整
6ae232055d4d8a97267517c5e50074c2c819941and することができます。
6ae232055d4d8a97267517c5e50074c2c819941and ほとんどのディレクティブはこれらのコンテナに設置することができて、
6ae232055d4d8a97267517c5e50074c2c819941and 変更点はそのバーチャルホストに対してのみ有効になります。
6ae232055d4d8a97267517c5e50074c2c819941and どのディレクティブを書くことができるかは、ディレクティブの <a href="/mod/directive-dist.html#context">コンテキスト</a> を
6ae232055d4d8a97267517c5e50074c2c819941and 調べてください。<em>主サーバコンテキスト</em>
6ae232055d4d8a97267517c5e50074c2c819941and (<code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and コンテナの外) の設定用ディレクティブはバーチャルホストでの設定で
6ae232055d4d8a97267517c5e50074c2c819941and 上書きされない場合のみ使用されます。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>リクエストが来ると、サーバはまず最初に <code class="directive"><a href="/mod/core.html#namevirtualhost">&lt;NameVirtualHost&gt;</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and にマッチする IP アドレスかどうかをチェックします。マッチすれば
6ae232055d4d8a97267517c5e50074c2c819941and マッチした IP アドレスの <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and のそれぞれのセクションの中から
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code> か
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#serveralias">ServerAlias</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and に要求されたホスト名があるか探します。
6ae232055d4d8a97267517c5e50074c2c819941and 見つかればそのサーバ用の設定を使います。マッチするバーチャルホスト
6ae232055d4d8a97267517c5e50074c2c819941and が見つからなければ、マッチした IP アドレスの
6ae232055d4d8a97267517c5e50074c2c819941and <strong>リストの最初にあるバーチャルホスト</strong> が使われます。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>結果として、リストの最初のバーチャルホストが <em>デフォルト</em> の
6ae232055d4d8a97267517c5e50074c2c819941and バーチャルホストになります。IP アドレスが <code class="directive"><a href="/mod/core.html#namevirtualhost">NameVirtualHost</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and ディレクティブにマッチした場合は、<em>メインのサーバ</em> の
6ae232055d4d8a97267517c5e50074c2c819941and <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>
6ae232055d4d8a97267517c5e50074c2c819941and は<strong>決して使われません</strong>
6ae232055d4d8a97267517c5e50074c2c819941and どのバーチャルホストにもマッチしないリクエストに対して、
6ae232055d4d8a97267517c5e50074c2c819941and 特別な設定をしたいのであれば、設定ファイル中の最初の
6ae232055d4d8a97267517c5e50074c2c819941and <code>&lt;VirtualHost&gt;</code> コンテナにそれを記述してください。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6ae232055d4d8a97267517c5e50074c2c819941and<div class="section">
6ae232055d4d8a97267517c5e50074c2c819941and<h2><a name="compat" id="compat">古いブラウザとの互換性</a></h2>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>以前述べたように、名前ベースのバーチャルホストが正しく動作する
6ae232055d4d8a97267517c5e50074c2c819941and ために必要な情報を送ってこないクライアントが依然として存在しています。
6ae232055d4d8a97267517c5e50074c2c819941and そのようなクライアントに対しては、該当する IP アドレスについて、
6ae232055d4d8a97267517c5e50074c2c819941and 一番最初に設定されているバーチャルホスト
6ae232055d4d8a97267517c5e50074c2c819941and (<cite>プライマリ</cite>の名前ベースのバーチャルホスト)
6ae232055d4d8a97267517c5e50074c2c819941and からページが送り返されます。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <div class="note"><h3>どのぐらい古いの ?</h3>
6ae232055d4d8a97267517c5e50074c2c819941and <p>「古い」と表現している場合、本当に古いことを意味して使っています。
6ae232055d4d8a97267517c5e50074c2c819941and 不幸にして今現在でもこのような古いブラウザに遭遇することがあります。
6ae232055d4d8a97267517c5e50074c2c819941and 現在のブラウザは全て、名前ベースのバーチャルホストに必要な
6ae232055d4d8a97267517c5e50074c2c819941and <code>Host</code> ヘッダを送ります。</p>
6ae232055d4d8a97267517c5e50074c2c819941and </div>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p><a href="/mod/core.html#serverpath"><code>ServerPath</code></a>
6ae232055d4d8a97267517c5e50074c2c819941and ディレクティブで対処が可能です。ちょっと不格好ですけれども。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>設定例</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <div class="example"><p><code>
6ae232055d4d8a97267517c5e50074c2c819941and NameVirtualHost 111.22.33.44<br />
6ae232055d4d8a97267517c5e50074c2c819941and <br />
6ae232055d4d8a97267517c5e50074c2c819941and &lt;VirtualHost 111.22.33.44&gt;<br />
6ae232055d4d8a97267517c5e50074c2c819941and <span class="indent">
6ae232055d4d8a97267517c5e50074c2c819941and ServerName www.domain.tld<br />
6ae232055d4d8a97267517c5e50074c2c819941and ServerPath /domain<br />
6ae232055d4d8a97267517c5e50074c2c819941and DocumentRoot /web/domain<br />
6ae232055d4d8a97267517c5e50074c2c819941and </span>
6ae232055d4d8a97267517c5e50074c2c819941and &lt;/VirtualHost&gt;<br />
6ae232055d4d8a97267517c5e50074c2c819941and </code></p></div>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>この例にはどういう意味があるでしょうか? これは
6ae232055d4d8a97267517c5e50074c2c819941and "<code>/domain</code>" で始まる URI へのリクエストはすべて、
6ae232055d4d8a97267517c5e50074c2c819941and バーチャルホスト <code>www.domain.tld</code> で処理される、
6ae232055d4d8a97267517c5e50074c2c819941and という意味です。つまり、すべてのクライアントで
6ae232055d4d8a97267517c5e50074c2c819941and <code>http://www.domain.tld/domain/</code> でアクセスできるページが、
6ae232055d4d8a97267517c5e50074c2c819941and <code>Host:</code> ヘッダを送ってくるクライアントであれば
6ae232055d4d8a97267517c5e50074c2c819941and <code>http://www.domain.tld/</code> としてもアクセスできる、
6ae232055d4d8a97267517c5e50074c2c819941and という意味です。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>これが動作するようにするには、
6ae232055d4d8a97267517c5e50074c2c819941and プライマリのバーチャルホストのページに
6ae232055d4d8a97267517c5e50074c2c819941and <code>http://www.domain.tld/domain/</code> へのリンクを設置します。
6ae232055d4d8a97267517c5e50074c2c819941and そして、バーチャルホストのページでは、純粋な相対リンク (<em>例:</em>
6ae232055d4d8a97267517c5e50074c2c819941and "<code>file.html</code>" や "<code>/icons/image.gif</code>")、
6ae232055d4d8a97267517c5e50074c2c819941and あるいは <code>/domain/</code> で始まるリンク (<em>例:</em>
6ae232055d4d8a97267517c5e50074c2c819941and "<code>http://www.domain.tld/domain/misc/file.html</code>" や
6ae232055d4d8a97267517c5e50074c2c819941and "<code>/domain/misc/file.html</code>") だけを設置します。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and <p>これには、幾分かの規律が必要となりますが、
6ae232055d4d8a97267517c5e50074c2c819941and このようなガイドラインを忠実に守ることにより、たいていの場合、
4b3a8afbfcea8b265d179a122bf40dfedd1ce280takashi すべてのブラウザで ― 新しいブラウザでも古いものでも ―
6ae232055d4d8a97267517c5e50074c2c819941and 作成したページが見えるということを保証します。</p>
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and</div></div>
6ae232055d4d8a97267517c5e50074c2c819941and<div class="bottomlang">
b43f840409794ed298e8634f6284741f193b6c4ftakashi<p><span>翻訳済み言語: </span><a href="/de/vhosts/name-based.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
6ae232055d4d8a97267517c5e50074c2c819941and<a href="/en/vhosts/name-based.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
6ae232055d4d8a97267517c5e50074c2c819941and<a href="/fr/vhosts/name-based.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
6ae232055d4d8a97267517c5e50074c2c819941and<a href="/ja/vhosts/name-based.html" title="Japanese">&nbsp;ja&nbsp;</a> |
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<a href="/ko/vhosts/name-based.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/tr/vhosts/name-based.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
727872d18412fc021f03969b8641810d8896820bhumbedooh</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">コメント</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
0d0ba3a410038e179b695446bb149cce6264e0abnd<script type="text/javascript"><!--//--><![CDATA[//><!--
727872d18412fc021f03969b8641810d8896820bhumbedoohvar comments_shortname = 'httpd';
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohvar comments_identifier = 'http://httpd.apache.org/docs/trunk/vhosts/name-based.html';
0d0ba3a410038e179b695446bb149cce6264e0abnd(function(w, d) {
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread"><\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd var s = d.createElement('script');
0d0ba3a410038e179b695446bb149cce6264e0abnd s.type = 'text/javascript';
0d0ba3a410038e179b695446bb149cce6264e0abnd s.async = true;
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
0d0ba3a410038e179b695446bb149cce6264e0abnd (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
0d0ba3a410038e179b695446bb149cce6264e0abnd }
0d0ba3a410038e179b695446bb149cce6264e0abnd else {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd }
0d0ba3a410038e179b695446bb149cce6264e0abnd})(window, document);
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh//--><!]]></script></div><div id="footer">
205f749042ed530040a4f0080dbcb47ceae8a374rjung<p class="apache">Copyright 2015 The Apache Software Foundation.<br />この文書は <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">モジュール</a> | <a href="/mod/quickreference.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">用語</a> | <a href="/sitemap.html">サイトマップ</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
0d0ba3a410038e179b695446bb149cce6264e0abndif (typeof(prettyPrint) !== 'undefined') {
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd prettyPrint();
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd}
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd//--><!]]></script>
6ae232055d4d8a97267517c5e50074c2c819941and</body></html>