1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"><head><!-- 4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 5 This file is generated from xml source: DO NOT EDIT 6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 7 --> 8<title>Apache の IP ベースのバーチャルホストサポート - Apache HTTP サーバ</title> 9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> 10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> 11<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" /> 12<script src="/style/scripts/prettify.min.js" type="text/javascript"> 13</script> 14 15<link href="/images/favicon.ico" rel="shortcut icon" /></head> 16<body id="manual-page"><div id="page-header"> 17<p class="menu"><a href="/mod/">モジュール</a> | <a href="/mod/directives.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">用語</a> | <a href="/sitemap.html">サイトマップ</a></p> 18<p class="apache">Apache HTTP サーバ バージョン 2.4</p> 19<img alt="" src="/images/feather.gif" /></div> 20<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div> 21<div id="path"> 22<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP サーバ</a> > <a href="http://httpd.apache.org/docs/">ドキュメンテーション</a> > <a href="../">バージョン 2.4</a> > <a href="./">バーチャルホスト</a></div><div id="page-content"><div id="preamble"><h1>Apache の IP ベースのバーチャルホストサポート</h1> 23<div class="toplang"> 24<p><span>翻訳済み言語: </span><a href="/en/vhosts/ip-based.html" hreflang="en" rel="alternate" title="English"> en </a> | 25<a href="/fr/vhosts/ip-based.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | 26<a href="/ja/vhosts/ip-based.html" title="Japanese"> ja </a> | 27<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | 28<a href="/tr/vhosts/ip-based.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> 29</div> 30<div class="outofdate">この日本語訳はすでに古くなっている 31 可能性があります。 32 最近更新された内容を見るには英語版をご覧下さい。 33 </div> 34</div> 35<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#requirements">システム要件</a></li> 36<li><img alt="" src="/images/down.gif" /> <a href="#howto">Apache の設定方法</a></li> 37<li><img alt="" src="/images/down.gif" /> <a href="#multiple">複数デーモンの設定</a></li> 38<li><img alt="" src="/images/down.gif" /> <a href="#single">複数のバーチャルホストの設定をした 39デーモンを一つ設定する</a></li> 40</ul><h3>参照</h3><ul class="seealso"><li> 41<a href="name-based.html">名前ベースのバーチャルホストサポート</a> 42</li></ul><ul class="seealso"><li><a href="#comments_section">コメント</a></li></ul></div> 43<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 44<div class="section"> 45<h2><a name="requirements" id="requirements">システム要件</a></h2> 46 47 <p><cite>IP ベース</cite> という名前が示すように、サーバには 48 <strong>IP ベースのバーチャルホストそれぞれにつき、別々の IP アドレスが 49 必要です</strong>。複数の物理コネクションを持っているマシンを用意するか、 50 最近のオペレーティングシステムでサポートされているバーチャル 51 インタフェース (詳細はシステムの説明書を読んでください。たいていは 52 "ip エイリアス" と呼ばれていて、設定には普通 "ifconfig" コマンドを 53 使います) を使うかで実現できます。</p> 54</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 55<div class="section"> 56<h2><a name="howto" id="howto">Apache の設定方法</a></h2> 57 58 <p>複数のホストをサポートするように Apache を設定する方法は 59 二通りあります。別の <code class="program"><a href="/programs/httpd.html">httpd</a></code> デーモンを各ホスト毎に実行するか、 60 すべてのバーチャルホストをサポートするデーモンを一つ実行するかです。</p> 61 62 <p>以下のときには複数のデーモンを使うと良いでしょう:</p> 63 64 <ul> 65 <li>会社1 はウェブ経由以外では会社2 からはデータを読まれたくない、 66 といったセキュリティの分離の問題があるとき。この場合、それぞれ 67 <code class="directive"><a href="/mod/mpm_common.html#user">User</a></code>, <code class="directive"><a href="/mod/mpm_common.html#group">Group</a></code>, <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>, <code class="directive"><a href="/mod/core.html#serverroot">ServerRoot</a></code> の設定が違う二つのデーモンを 68 実行する必要があります。</li> 69 70 <li>マシンのすべての IP エイリアスを listen するだけの 71 メモリとファイル記述子の余裕があるとき。<code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> は「ワイルドカード」 72 アドレスか、特定のアドレスのみを listen することができます。 73 ですから、何らかの理由で特定のアドレスを listen しなけばならない 74 ときは、その特定のアドレスをすべて listen する必要があります。 75 (ただし、一つの <code class="program"><a href="/programs/httpd.html">httpd</a></code> が N-1 個のアドレスを listen し、 76 別の <code class="program"><a href="/programs/httpd.html">httpd</a></code> が残りのアドレスを listen するといったことは可能です。)</li> 77 </ul> 78 79 <p>以下のときには単独のデーモンを使うと良いでしょう:</p> 80 81 <ul> 82 <li>バーチャルホスト間での httpd の設定を共有してもよいとき。</li> 83 84 <li>マシンが多くのリクエストを扱うため、別デーモンを実行することによる 85 性能の低下の影響が著しいとき。</li> 86 </ul> 87 88</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 89<div class="section"> 90<h2><a name="multiple" id="multiple">複数デーモンの設定</a></h2> 91 92 <p>各バーチャルホストに対して別の <code class="program"><a href="/programs/httpd.html">httpd</a></code> のインストールを行ないます。 93 設定ファイル中の <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> 94 ディレクティブを使って、 95 各インストールでデーモンが扱う IP アドレス (バーチャルホスト) 96 を選択します。例えば</p> 97 98 <div class="example"><p><code> 99 Listen www.smallco.com:80 100 </code></p></div> 101 102 <p>ここで、ホスト名の代わりに IP アドレスを使う方が推奨されていることに 103 注意しておいてください 104 (<a href="/dns-caveats.html">DNS の注意事項</a> 参照)。</p> 105 106</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 107<div class="section"> 108<h2><a name="single" id="single">複数のバーチャルホストの設定をした 109デーモンを一つ設定する</a></h2> 110 111 <p>この場合は、一つの <code class="program"><a href="/programs/httpd.html">httpd</a></code> が主サーバとすべてのバーチャルホストのリクエストを 112 処理します。設定ファイルの <code class="directive"><a href="/mod/core.html#virtualhost">VirtualHost</a></code> ディレクティブを使って、 113 <code class="directive"><a href="/mod/core.html#serveradmin">ServerAdmin</a></code>, <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code>, <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>, <code class="directive"><a href="/mod/core.html#errorlog">ErrorLog</a></code>, <code class="directive"><a href="/mod/mod_log_config.html#transferlog">TransferLog</a></code> 114 や <code class="directive"><a href="/mod/mod_log_config.html#customlog">CustomLog</a></code> 115 設定ディレクティブの値が各ホスト毎に異なる値に設定されるようにします。 116 例えば</p> 117 118 <div class="example"><p><code> 119 <VirtualHost www.smallco.com><br /> 120 ServerAdmin webmaster@mail.smallco.com<br /> 121 DocumentRoot /groups/smallco/www<br /> 122 ServerName www.smallco.com<br /> 123 ErrorLog /groups/smallco/logs/error_log<br /> 124 TransferLog /groups/smallco/logs/access_log<br /> 125 </VirtualHost><br /> 126 <br /> 127 <VirtualHost www.baygroup.org><br /> 128 ServerAdmin webmaster@mail.baygroup.org<br /> 129 DocumentRoot /groups/baygroup/www<br /> 130 ServerName www.baygroup.org<br /> 131 ErrorLog /groups/baygroup/logs/error_log<br /> 132 TransferLog /groups/baygroup/logs/access_log<br /> 133 </VirtualHost> 134 </code></p></div> 135 136 <p>ここで、ホスト名の代わりに IP アドレスを使う方が推奨されていることに 137 注意しておいてください 138 (<a href="/dns-caveats.html">DNS の注意事項</a> 参照)。</p> 139 140 <p>プロセス生成を制御するディレクティブやその他のいくつかのディレクティブを 141 除いて、ほぼ<strong>すべて</strong>の設定ディレクティブを VirtualHost 142 ディレクティブの中に書くことができます。ディレクティブが VirtualHost 143 ディレクティブで使用できるかどうかは <a href="/mod/directives.html">ディレクティブ索引</a>を使って<a href="/mod/directive-dict.html#Context">コンテキスト</a>の 144 欄を調べてください。</p> 145 146 <p><a href="/suexec.html">suEXECラッパー</a>を使っている場合は、 147 <code class="directive"><a href="/mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code> 148 ディレクティブを VirtualHost 149 ディレクティブの中で使用することができます。</p> 150 151 <p><em>セキュリティ:</em> ログファイルを書く場所を指定するときは、 152 Apache を起動したユーザ以外がそのディレクトリに書き込み権限を 153 持っている場合にセキュリティ上の危険があることに注意してください。 154 詳細は<a href="/misc/security_tips.html">セキュリティのこつ</a>ドキュメントを 155 参照してください。</p> 156 157</div></div> 158<div class="bottomlang"> 159<p><span>翻訳済み言語: </span><a href="/en/vhosts/ip-based.html" hreflang="en" rel="alternate" title="English"> en </a> | 160<a href="/fr/vhosts/ip-based.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | 161<a href="/ja/vhosts/ip-based.html" title="Japanese"> ja </a> | 162<a href="/ko/vhosts/ip-based.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | 163<a href="/tr/vhosts/ip-based.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> 164</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&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> 165<script type="text/javascript"><!--//--><![CDATA[//><!-- 166var comments_shortname = 'httpd'; 167var comments_identifier = 'http://httpd.apache.org/docs/2.4/vhosts/ip-based.html'; 168(function(w, d) { 169 if (w.location.hostname.toLowerCase() == "httpd.apache.org") { 170 d.write('<div id="comments_thread"><\/div>'); 171 var s = d.createElement('script'); 172 s.type = 'text/javascript'; 173 s.async = true; 174 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; 175 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); 176 } 177 else { 178 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); 179 } 180})(window, document); 181//--><!]]></script></div><div id="footer"> 182<p class="apache">Copyright 2014 The Apache Software Foundation.<br />この文書は <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p> 183<p class="menu"><a href="/mod/">モジュール</a> | <a href="/mod/directives.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[//><!-- 184if (typeof(prettyPrint) !== 'undefined') { 185 prettyPrint(); 186} 187//--><!]]></script> 188</body></html>