]> granicus.if.org Git - apache/blob - docs/manual/sections.html.ja.utf8
move es and fr targets to *.utf8 extension. Update transformation
[apache] / docs / manual / sections.html.ja.utf8
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 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5 <!--
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7               This file is generated from xml source: DO NOT EDIT
8         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9       -->
10 <title>セクションの設定 - Apache HTTP サーバ バージョン 2.5</title>
11 <link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <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" />
14 <script src="./style/scripts/prettify.min.js" type="text/javascript">
15 </script>
16
17 <link href="./images/favicon.ico" rel="shortcut icon" /></head>
18 <body id="manual-page"><div id="page-header">
19 <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>
20 <p class="apache">Apache HTTP サーバ バージョン 2.5</p>
21 <img alt="" src="./images/feather.png" /></div>
22 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="./images/left.gif" /></a></div>
23 <div id="path">
24 <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></div><div id="page-content"><div id="preamble"><h1>セクションの設定</h1>
25 <div class="toplang">
26 <p><span>翻訳済み言語: </span><a href="./en/sections.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
27 <a href="./fr/sections.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
28 <a href="./ja/sections.html" title="Japanese">&nbsp;ja&nbsp;</a> |
29 <a href="./ko/sections.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
30 <a href="./tr/sections.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
31 </div>
32 <div class="outofdate">この日本語訳はすでに古くなっている
33             可能性があります。
34             最近更新された内容を見るには英語版をご覧下さい。
35         </div>
36  <p><a href="configuring.html">設定ファイル</a>中のディレクティブは
37 サーバ全体に適用されたり、特定のディレクトリやファイル、ホスト、URL にのみ
38 適用されるように制限したりすることができます。この文書は設定用のセクションの
39 コンテナや <code>.htaccess</code> ファイルを使って他の設定ディレクティブの
40 スコープを変更する方法を説明します。</p>
41 </div>
42 <div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#types">設定用セクションコンテナの種類</a></li>
43 <li><img alt="" src="./images/down.gif" /> <a href="#file-and-web">ファイルシステムとウェブ空間</a></li>
44 <li><img alt="" src="./images/down.gif" /> <a href="#virtualhost">バーチャルホスト</a></li>
45 <li><img alt="" src="./images/down.gif" /> <a href="#proxy">プロクシ</a></li>
46 <li><img alt="" src="./images/down.gif" /> <a href="#whatwhere">どのディレクティブが使えるの?</a></li>
47 <li><img alt="" src="./images/down.gif" /> <a href="#mergin">セクションのマージ方法</a></li>
48 </ul><h3>参照</h3><ul class="seealso"><li><a href="#comments_section">コメント</a></li></ul></div>
49 <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
50 <div class="section">
51 <h2><a name="types" id="types">設定用セクションコンテナの種類</a><a title="Permanent link" href="#types" class="permalink">&para;</a></h2>
52
53 <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><li><code class="module"><a href="./mod/mod_version.html">mod_version</a></code></li><li><code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code></li><li><code class="directive"><a href="./mod/core.html#directorymatch">&lt;DirectoryMatch&gt;</a></code></li><li><code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code></li><li><code class="directive"><a href="./mod/core.html#filesmatch">&lt;FilesMatch&gt;</a></code></li><li><code class="directive"><a href="./mod/core.html#ifdefine">&lt;IfDefine&gt;</a></code></li><li><code class="directive"><a href="./mod/core.html#ifmodule">&lt;IfModule&gt;</a></code></li><li><code class="directive"><a href="./mod/mod_version.html#ifversion">&lt;IfVersion&gt;</a></code></li><li><code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code></li><li><code class="directive"><a href="./mod/core.html#locationmatch">&lt;LocationMatch&gt;</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxy">&lt;Proxy&gt;</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxymatch">&lt;ProxyMatch&gt;</a></code></li><li><code class="directive"><a href="./mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code></li></ul></td></tr></table>
54
55 <p>コンテナには二つの基本となる種類があります。ほとんどのコンテナは
56 各リクエストに対して評価されます。その場合、コンテナ中のディレクティブは
57 コンテナにマッチするリクエストにのみ適用されます。一方、
58 <code class="directive"><a href="./mod/core.html#ifdefine">&lt;IfDefine&gt;</a></code>, 
59 <code class="directive"><a href="./mod/core.html#ifmodule">&lt;IfModule&gt;</a></code>, 
60 <code class="directive"><a href="./mod/mod_version.html#ifversion">&lt;IfVersion&gt;</a></code>
61 コンテナは
62 サーバの起動時と再起動時にのみ評価されます。起動時に条件が真であれば、
63 コンテナ中のディレクティブはすべてのリクエストに適用されます。条件が
64 偽であれば、コンテナ中のディレクティブは無視されます。</p>
65
66 <p><code class="directive"><a href="./mod/core.html#ifdefine">&lt;IfDefine&gt;</a></code> ディレクティブは
67 <code class="program"><a href="./programs/httpd.html">httpd</a></code> コマンドラインで適切なパラメータが定義されたときにのみ
68 適用されるディレクティブを囲います。例えば次の設定では、サーバが
69 <code>httpd -DClosedForNow</code> を使って起動されたときだけすべての
70 リクエストを別のサイトにリダイレクトします:</p>
71
72 <div class="example"><p><code>
73 &lt;IfDefine ClosedForNow&gt;<br />
74 Redirect / http://otherserver.example.com/<br />
75 &lt;/IfDefine&gt;
76 </code></p></div>
77
78 <p><code class="directive"><a href="./mod/core.html#ifmodule">&lt;IfModule&gt;</a></code> は
79 非常に似ていますが、代わりにサーバ上でモジュールが使用可能な場合にのみ
80 適用可能なディレクティブを囲います。モジュールはサーバに
81 静的に組み込まれているか、動的に組み込むようになっていて、設定ファイル中で
82 <code class="directive"><a href="./mod/mod_so.html#loadmodule">LoadModule</a></code> の行がより前の
83 部分に書かれている必要があります。このディレクティブは特定のモジュールの
84 存在に関わらず設定ファイルが動作する必要がある場合にのみ使ってください。
85 常に動作して欲しいディレクティブを囲むために使うべきではありません。
86 存在しないモジュールに関する有用なエラーメッセージの発生を抑制してしまいますので。
87 </p>
88
89 <p>次の例では、<code class="module"><a href="./mod/mod_mime_magic.html">mod_mime_magic</a></code> があるときにのみ <code class="directive"><a href="./mod/mod_mime_magic.html#mimemagicfiles">MimeMagicFiles</a></code> ディレクティブが
90 適用されます。</p>
91
92 <div class="example"><p><code>
93 &lt;IfModule mod_mime_magic.c&gt;<br />
94 MimeMagicFile conf/magic<br />
95 &lt;/IfModule&gt;
96 </code></p></div>
97
98 <p><code class="directive"><a href="./mod/mod_version.html#ifversion">&lt;IfVersion&gt;</a></code>
99 ディレクティブは
100 <code class="directive"><a href="./mod/core.html#ifdefine">&lt;IfDefine&gt;</a></code> や
101 <code class="directive"><a href="./mod/core.html#ifmodule">&lt;IfModule&gt;</a></code>と、
102 とてもよく似ていますが、稼働中のサーバのバージョンが特定のバージョンの時にのみ
103 適用されます。様々なバージョンの httpd を様々な設定で動作させることになる場合で、
104 テストスイートや巨大なネットワークでの用途を想定して、
105 このモジュールは設計されています。</p>
106
107 <div class="example"><p><code>
108   &lt;IfVersion &gt;= 2.1&gt;<br />
109   <span class="indent">
110     # this happens only in versions greater or<br />
111     # equal 2.1.0.<br />
112   </span>
113   &lt;/IfVersion&gt;
114 </code></p></div>
115
116 <p><code class="directive"><a href="./mod/core.html#ifdefine">&lt;IfDefine&gt;</a></code>, 
117 <code class="directive"><a href="./mod/core.html#ifmodule">&lt;IfModule&gt;</a></code>,
118 <code class="directive"><a href="./mod/mod_version.html#ifversion">&lt;IfVersion&gt;</a></code> ディレクティブは
119 テストの前に "!" を付けることで否定の条件を適用することができます。
120 また、これらのセクションはより複雑な制限を課すために入れ子にすることができます。
121 </p>
122 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
123 <div class="section">
124 <h2><a name="file-and-web" id="file-and-web">ファイルシステムとウェブ空間</a><a title="Permanent link" href="#file-and-web" class="permalink">&para;</a></h2>
125
126 <p>最もよく使われる設定のセクションコンテナはファイルシステムやウェブ空間の
127 特定の場所の設定を変更するものです。まず、この二つの違いを理解することが
128 大切です。ファイルシステムはオペレーティングシステムから見たディスクの内容です。
129 たとえば、デフォルトのインストールでは Apache は Unix ファイルシステムでは
130 <code>/usr/local/apache2</code> に、Windows ファイルシステムでは
131 <code>"c:/Program Files/Apache Group/Apache2"</code> に存在します。
132 (Apache では Windows でもパスセパレータとしてスラッシュを使うことに
133 気をつけてください。) 対照的に、ウェブ空間はあなたのサイトを
134 ウェブサーバから配信されるものとして見たもので、クライアントに見えるものです。
135 デフォルトの Unix 上の Apache のインストールではウェブ空間の
136 <code>/dir/</code> というパスはファイルシステムの
137 <code>/usr/local/apache2/htdocs/dir/</code> というパスに対応します。
138 ウェブページはデータベースや他の場所から動的に生成することもできますので、
139 ウェブ空間はファイルシステムに直接マップする必要はありません。</p>
140
141 <h3><a name="filesystem" id="filesystem">ファイルシステムコンテナ</a></h3>
142
143 <p><code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> ディレクティブと
144 <code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code> ディレクティブ、それと
145 それらの正規表現版はディレクティブをファイルシステムの一部分に対して適用します。
146 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> セクションの
147 中のディレクティブは指定されたディレクトリとそのすべてのサブディレクトリに
148 適用されます。<a href="howto/htaccess.html">.htaccess ファイル</a>を
149 使うことでも同じ効果を得ることができます。例えば、次の設定では
150 <code>/var/web/dir1</code> とすべてのサブディレクトリに対して
151 ディレクトリインデックスを行ないます。</p>
152
153 <div class="example"><p><code>
154 &lt;Directory /var/web/dir1&gt;<br />
155 Options +Indexes<br />
156 &lt;/Directory&gt;
157 </code></p></div>
158
159 <p><code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code> セクションの
160 中にあるディレクティブはどのディレクトリにあるかに関わらず、指定された名前の
161 すべてのファイルに適用されます。ですから例えば以下の設定ディレクティブが
162 設定ファイルの主セクションに書かれたときには、すべての場所の
163 <code>private.html</code> という名前のファイルへのアクセスを拒否します。</p>
164
165 <div class="example"><p><code>
166 &lt;Files private.html&gt;<br />
167 Order allow,deny<br />
168 Deny from all<br />
169 &lt;/Files&gt;
170 </code></p></div>
171
172 <p>ファイルシステムの特定の場所にあるファイルを指定するために、
173 <code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code> セクションと
174 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> セクションを
175 組み合わせることができます。例えば、次の設定では
176 <code>/var/web/dir1/private.html</code>, 
177 <code>/var/web/dir1/subdir2/private.html</code>, 
178 <code>/var/web/dir1/subdir3/private.html</code> など、
179 <code>/var/web/dir1/</code> ディレクトリの下にあるすべての
180 <code>private.html</code> へのアクセスを拒否します。</p>
181
182 <div class="example"><p><code>
183 &lt;Directory /var/web/dir1&gt;<br />
184 &lt;Files private.html&gt;<br />
185 Order allow,deny<br />
186 Deny from all<br />
187 &lt;/Files&gt;<br />
188 &lt;/Directory&gt;
189 </code></p></div>
190
191
192 <h3><a name="webspace" id="webspace">ウェブ空間コンテナ</a></h3>
193
194 <p>一方、<code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code>
195 ディレクティブとその<a class="glossarylink" href="./glossary.html#regex" title="用語集を参照">正規表現</a>版は
196 ウェブ空間上の内容に対して設定を変更します。
197 たとえば、次の設定では /private で始まる URL パスへのアクセスを制限します。
198 具体的には、
199 <code>http://yoursite.example.com/private</code>,
200 <code>http://yoursite.example.com/private123</code>, 
201 <code>http://yoursite.example.com/private/dir/file.html</code> 
202 へのリクエストや、
203 他の同様に <code>/private</code> 文字列で始まるリクエストに
204 適用されます。</p>
205
206 <div class="example"><p><code>
207 &lt;Location /private&gt;<br />
208 Order Allow,Deny<br />
209 Deny from all<br />
210 &lt;/Location&gt;
211 </code></p></div>
212
213 <p><code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code>
214 ディレクティブはファイルシステムと関係ある必要が全くありません。
215 たとえば次の例では、どのようにして特定の URL を
216 <code class="module"><a href="./mod/mod_status.html">mod_status</a></code>で提供されている Apache 
217 内部ハンドラにマップするかを示しています。ファイルシステムに
218 <code>server-status</code> というファイルが存在する必要はありません。</p>
219
220 <div class="example"><p><code>
221 &lt;Location /server-status&gt;<br />
222 SetHandler server-status<br />
223 &lt;/Location&gt;
224 </code></p></div>
225
226
227 <h3><a name="wildcards" id="wildcards">ワイルドカードと正規表現</a></h3>
228
229 <p><code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code>, 
230 <code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code>, 
231 <code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code> 
232 ディレクティブでは、 C 標準ライブラリの <code>fnmatch</code> のように
233 shell スタイルのワイルドカードキャラクタが使用できます。
234 "*" 文字は任意の文字列にマッチし、"?" 文字は任意の 1 文字にマッチし、
235 "[<em>seq</em>]" は <em>seq</em> の任意の文字にマッチします。
236 "/" 文字はどのワイルドカードでもマッチされません。
237 明示的に指定する必要があります。</p>
238
239 <p>これより柔軟なマッチングが必要な場合は、これらのコンテナに正規表現
240 (regex) 版である
241 <code class="directive"><a href="./mod/core.html#directorymatch">&lt;DirectoryMatch&gt;</a></code>, 
242 <code class="directive"><a href="./mod/core.html#filesmatch">&lt;FilesMatch&gt;</a></code>, 
243 <code class="directive"><a href="./mod/core.html#locationmatch">&lt;LocationMatch&gt;</a></code>
244 があり、マッチを選択するのに perl 互換<a class="glossarylink" href="./glossary.html#regex" title="用語集を参照">正規表現</a>を使用できます。しかし、次の設定のマージに目を通して、
245 regex セクションを使用することで、ディレクティブの適用がどのように
246 変化するか把握しておいてください。</p>
247
248 <p>全ユーザディレクトリの設定を変更する、非 regex
249 ワイルドカードセクションは次のようになります。</p>
250
251 <div class="example"><p><code>
252 &lt;Directory /home/*/public_html&gt;<br />
253 Options Indexes<br />
254 &lt;/Directory&gt;
255 </code></p></div>
256
257 <p>regex セクションを使用することで、画像ファイルの多くのタイプに対する
258 アクセスを一度に拒否できます。</p>
259 <div class="example"><p><code>
260 &lt;FilesMatch \.(?i:gif|jpe?g|png)$&gt;<br />
261 Order allow,deny<br />
262 Deny from all<br />
263 &lt;/FilesMatch&gt;
264 </code></p></div>
265
266
267
268 <h3><a name="whichwhen" id="whichwhen">いつ何を使うか</a></h3>
269
270 <p>ファイルシステムコンテナとウェブ空間コンテナを使い分けるのは、
271 実際には非常に簡単です。ファイルシステムに依存する
272 オブジェクトにディレクティブを適応する場合は、必ず
273 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> か
274 <code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code>
275 を使用します。ファイルシステムに依存しないオブジェクト
276 (データベースから生成されるウェブページなど) 
277 にディレクティブを適用する際には、
278 <code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code>
279 を使用します。</p>
280
281 <p>ファイルシステム上のオブジェクトへのアクセスを制限するために、
282 <code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code>
283 を決して使用ないようにしましょう。
284 同一のファイルシステム位置にマップしている、ウェブ空間位置 (URL)
285 が多数あって、設定した制限を迂回されてしまうかもしれないからです。
286 例えば次の設定を考えてみましょう。</p>
287
288 <div class="example"><p><code>
289 &lt;Location /dir/&gt;<br />
290 Order allow,deny<br />
291 Deny from all<br />
292 &lt;/Location&gt;
293 </code></p></div>
294
295 <p><code>http://yoursite.example.com/dir/</code>
296 へのリクエストでは上手く動作します。しかし大文字小文字を区別しない
297 ファイルシステムを使っていたらどうなるでしょう?
298 <code>http://yoursite.example.com/DIR/</code> 
299 へのリクエストで簡単にアクセス制限を迂回されてしまいます。これに対して
300 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code>
301 ディレクティブを使用すると、どのように呼び出されたかに関わらず
302 その場所から提供される内容に適用されます。
303 (例外はファイルシステムのリンクです。シンボリックリンクを使って、
304 同一のディレクトリを複数のファイルシステムに設置できます。
305 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code>
306 ディレクティブはパス名をリセットすることなくシンボリックリンクを
307 辿ります。ですから、高度なセキュリティが要求される場合は、
308 適切に <code class="directive"><a href="./mod/core.html#options">Options</a></code> 
309 ディレクティブを使用してシンボリックリンクを無効にするべきです。)</p>
310
311 <p>大文字小文字を区別するファイルシステムを使用しているから上記のことは
312 無関係だと思われるかもしれませんが、
313 同一のファイルシステム位置に複数のウェブ空間位置をマップする方法は、
314 他にいくらでもあるということを覚えていてください。
315 ですからできる限りファイルシステムコンテナを使用してください。
316 しかしながら一つだけ例外があります。
317 <code>&lt;Location /&gt;</code> セクションはどんな URL 
318 にも関わらず適用されるので、完全に安全です。</p>
319
320
321 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
322 <div class="section">
323 <h2><a name="virtualhost" id="virtualhost">バーチャルホスト</a><a title="Permanent link" href="#virtualhost" class="permalink">&para;</a></h2>
324
325 <p><code class="directive"><a href="./mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
326 コンテナは特定のホストに適用するディレクティブを格納します。
327 一台のマシンで複数のホストを異なる設定で提供したいときに有用です。
328 詳細に関しては<a href="vhosts/">バーチャルホストドキュメント</a>を
329 ご覧下さい。</p>
330 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
331 <div class="section">
332 <h2><a name="proxy" id="proxy">プロクシ</a><a title="Permanent link" href="#proxy" class="permalink">&para;</a></h2>
333
334 <p><code class="directive"><a href="./mod/mod_proxy.html#proxy">&lt;Proxy&gt;</a></code>
335 と <code class="directive"><a href="./mod/mod_proxy.html#proxymatch">&lt;ProxyMatch&gt;</a></code>
336 コンテナは、特定の URL にマッチする <code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code>
337 プロクシサーバを経由してアクセスしたサイトに対してのみ適用される
338 設定ディレクティブを格納します。例えば次の設定は、<code>cnn.com</code> 
339 ウェブサイトにアクセスするために用いられるプロクシサーバを
340 制限します。</p>
341
342 <div class="example"><p><code>
343 &lt;Proxy http://cnn.com/*&gt;<br />
344 Order allow,deny<br />
345 Deny from all<br />
346 &lt;/Proxy&gt;
347 </code></p></div>
348 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
349 <div class="section">
350 <h2><a name="whatwhere" id="whatwhere">どのディレクティブが使えるの?</a><a title="Permanent link" href="#whatwhere" class="permalink">&para;</a></h2>
351
352 <p>どのタイプの設定セクションでどのディレクティブが使用できるかは、
353 ディレクティブの <a href="mod/directive-dict.html#Context">Context</a>
354 を見てください。
355 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code>
356 で使用可能なものは全て、同様に
357 <code class="directive"><a href="./mod/core.html#directorymatch">&lt;DirectoryMatch&gt;</a></code>,
358 <code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code>,
359 <code class="directive"><a href="./mod/core.html#filesmatch">&lt;FilesMatch&gt;</a></code>,
360 <code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code>,
361 <code class="directive"><a href="./mod/core.html#locationmatch">&lt;LocationMatch&gt;</a></code>,
362 <code class="directive"><a href="./mod/mod_proxy.html#proxy">&lt;Proxy&gt;</a></code>,
363 <code class="directive"><a href="./mod/mod_proxy.html#proxymatch">&lt;ProxyMatch&gt;</a></code>
364 セクションで使用可能です。しかしながら幾つか例外も存在します。</p>
365
366 <ul>
367 <li><code class="directive"><a href="./mod/core.html#allowoverride">AllowOverride</a></code> ディレクティブは
368 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code>
369 セクションでのみ使用可能です。</li>
370
371 <li><code>FollowSymLinks</code> と <code>SymLinksIfOwnerMatch</code> の
372 <code class="directive"><a href="./mod/core.html#options">Options</a></code> は、
373 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code>
374 セクションか <code>.htaccess</code> ファイルでのみ使用可能です。</li>
375
376 <li><code class="directive"><a href="./mod/core.html#options">Options</a></code> ディレクティブは、
377 <code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code>
378 と <code class="directive"><a href="./mod/core.html#filesmatch">&lt;FilesMatch&gt;</a></code>
379 セクションでは使用できません。</li>
380 </ul>
381 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
382 <div class="section">
383 <h2><a name="mergin" id="mergin">セクションのマージ方法</a><a title="Permanent link" href="#mergin" class="permalink">&para;</a></h2>
384
385     <p>マージの順番は以下のようになっています:</p>
386
387     <ol>
388       <li><code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> (正規表現無し) と
389       <code>.htaccess</code> を同時に (<code>.htaccess</code> が許可されていれば、それが
390       <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> を上書きします)
391       </li>
392
393       <li><code class="directive"><a href="./mod/core.html#directorymatch">&lt;DirectoryMatch&gt;</a></code>
394       (と <code>&lt;Directory ~&gt;</code></li>
395
396       <li><code class="directive"><a href="./mod/core.html#files">&lt;Files&gt;</a></code> と
397       <code class="directive"><a href="./mod/core.html#filesmatch">&lt;FilesMatch&gt;</a></code> を同時に</li>
398
399       <li><code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code> と
400       <code class="directive"><a href="./mod/core.html#locationmatch">&lt;LocationMatch&gt;</a></code> を同時に</li>
401     </ol>
402
403     <p><code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code>
404     以外は、それぞれのグループは設定ファイルに現れた順番に処理されます。
405     <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> (上のグループ 1)
406     はディレクトリが短いものから長いものへと処理されます。ですから、
407     例えば <code>&lt;Directory /var/web/dir1&gt;</code> は
408     <code>&lt;Directory /var/web/dir/subdir&gt;</code> の前に処理されます。複数の
409     <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> セクションが
410     同じディレクトリに
411     適用される場合は、設定ファイル中の順番に従って処理されます。
412     <code class="directive"><a href="./mod/core.html#include">Include</a></code>
413     によって挿入された設定は 挿入しているファイルの
414     <code class="directive"><a href="./mod/core.html#include">Include</a></code>
415     ディレクティブの位置にあったかのように扱われます。</p>
416
417     <p><code class="directive"><a href="./mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> セクション中のセクションは
418     バーチャルホストの定義の外側の対応するセクションの
419     <em>後</em>に適用されます。これによりバーチャルホストが
420     メインのサーバ設定を上書きできるようなります。</p>
421
422     <p><code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code> でリクエストが処理される場合は、
423     処理順番のうち、<code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> コンテナの部分が
424     <code class="directive"><a href="./mod/mod_proxy.html#proxy">&lt;Proxy&gt;</a></code>
425     コンテナに取って代わられます。</p>
426
427     <p>後のセクションのディレクティブが前のセクションのものを上書きします。</p>
428
429
430 <div class="note"><h3>技術メモ</h3>
431       実際には、名前を変換する段階 (URL
432       をファイル名にマップするために <code>Alias</code> や
433       <code>DocumentRoot</code> が使用されるところ) の直前に
434       <code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code>/<code class="directive"><a href="./mod/core.html#locationmatch">&lt;LocationMatch&gt;</a></code>
435       が行なわれます。
436       これらを適用した結果は変換が終わった後に完全に捨てられます。
437 </div>
438 <h3><a name="merge-examples" id="merge-examples">例</a></h3>
439
440 <p>次はマージの順番を示すための恣意的な例になっています。
441 リクエスト全てに適用されるとして、本例のディレクティブは
442 A &gt; B &gt; C &gt; D &gt; E の順番に適用されます。</p>
443
444 <div class="example"><p><code>
445 &lt;Location /&gt;<br />
446 E<br />
447 &lt;/Location&gt;<br />
448 <br />
449 &lt;Files f.html&gt;<br />
450 D<br />
451 &lt;/Files&gt;<br />
452 <br />
453 &lt;VirtualHost *&gt;<br />
454 &lt;Directory /a/b&gt;<br />
455 B<br />
456 &lt;/Directory&gt;<br />
457 &lt;/VirtualHost&gt;<br />
458 <br />
459 &lt;DirectoryMatch "^.*b$"&gt;<br />
460 C<br />
461 &lt;/DirectoryMatch&gt;<br />
462 <br />
463 &lt;Directory /a/b&gt;<br />
464 A<br />
465 &lt;/Directory&gt;<br />
466 <br />
467 </code></p></div>
468
469 <p>もっと具体的な、次の例を考えてみましょう。
470 <code class="directive"><a href="./mod/core.html#directory">&lt;Directory&gt;</a></code> 
471 セクションに設置されたアクセス制限に関わらず、
472 <code class="directive"><a href="./mod/core.html#location">&lt;Location&gt;</a></code>
473 セクションが最後に評価されて、サーバへのアクセスは制限されません。
474 言い換えれば、マージの順番は重要で、注意して使用してください!</p>
475
476 <div class="example"><p><code>
477 &lt;Location /&gt;<br />
478 Order deny,allow<br />
479 Allow from all<br />
480 &lt;/Location&gt;<br />
481 <br />
482 # Woops!  This &lt;Directory&gt; section will have no effect<br />
483 &lt;Directory /&gt;<br />
484 Order allow,deny<br />
485 Allow from all<br />
486 Deny from badguy.example.com<br />
487 &lt;/Directory&gt;
488 </code></p></div>
489
490
491
492 </div></div>
493 <div class="bottomlang">
494 <p><span>翻訳済み言語: </span><a href="./en/sections.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
495 <a href="./fr/sections.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
496 <a href="./ja/sections.html" title="Japanese">&nbsp;ja&nbsp;</a> |
497 <a href="./ko/sections.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
498 <a href="./tr/sections.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
499 </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>
500 <script type="text/javascript"><!--//--><![CDATA[//><!--
501 var comments_shortname = 'httpd';
502 var comments_identifier = 'http://httpd.apache.org/docs/trunk/sections.html';
503 (function(w, d) {
504     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
505         d.write('<div id="comments_thread"><\/div>');
506         var s = d.createElement('script');
507         s.type = 'text/javascript';
508         s.async = true;
509         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
510         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
511     }
512     else {
513         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
514     }
515 })(window, document);
516 //--><!]]></script></div><div id="footer">
517 <p class="apache">Copyright 2018 The Apache Software Foundation.<br />この文書は <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p>
518 <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[//><!--
519 if (typeof(prettyPrint) !== 'undefined') {
520     prettyPrint();
521 }
522 //--><!]]></script>
523 </body></html>