summaryrefslogtreecommitdiff
path: root/docs/manual/vhosts/examples.xml.ja
blob: 0da43c657e1540b88682c1c33db28a91375659ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
<?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:1132802 (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="examples.xml.meta">
<parentdocument href="./">バーチャルホスト</parentdocument>
    <title>バーチャルホストの例</title>

<summary>

    <p>この文書は、バーチャルホストの設定の際に
    よくある質問に答えるものです。想定している対象は <a
    href="name-based.html">名前ベース</a> や <a
    href="ip-based.html">IP ベース</a> のバーチャルホストを使って
    一つのサーバで複数のウェブサイトを運用している状況です。
    </p>

</summary>

  <section id="purename"><title>一つの IP アドレスでいくつかの名前ベースの
    ウェブサイトを実行する</title>

    <p>サーバは IP アドレスを一つ割り当てられていて、DNS でマシンに
    複数の名前 (CNAME) が指定されています。このマシンで
    <code>www.example.com</code> と <code>www.example.org</code>
    のためのウェブサーバを実行させたいとします。</p>

    <note><title>注</title><p>
          Apache サーバの設定でバーチャルホストの設定をしただけで、
          知らない間にそのホスト名に対応する DNS のエントリが
          作成されたりはしません。そのサーバの IP アドレスに解決される
          ように DNS に名前を登録しなければ<em>なりません</em>。
          そうでないと誰もあなたのウェブサイトを見ることはできません。
          ローカルでのテストのために <code>hosts</code> ファイルに
          エントリを追加することもできますが、この場合はその
          hosts エントリのあるマシンからしか動作しません。</p>
    </note>

    <example>
    <title>サーバ設定</title>

    # Ensure that Apache listens on port 80<br />
    Listen 80<br />
    <br />
    # Listen for virtual host requests on all IP addresses<br />
    NameVirtualHost *:80<br />
    <br />
    &lt;VirtualHost *:80&gt;<br />
    <indent>
      DocumentRoot /www/example1<br />
      ServerName www.example.com<br />
      <br />
      # Other directives here<br />
      <br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost *:80&gt;<br />
    <indent>
      DocumentRoot /www/example2<br />
      ServerName www.example.org<br />
      <br />
      # Other directives here<br />
      <br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    <p>アスタリスクはすべてのアドレスにマッチしますので、主サーバは
    リクエストを扱いません。<code>www.example.com</code> は
    最初にあるため、優先順位は一番高くなり、<cite>default</cite> もしくは
    <cite>primary</cite>  のサーバと考えることができます。つまり、リクエストが
    どの <code>ServerName</code> ディレクティブにもマッチしない場合、
    一番最初の <code>VirtualHost</code> により扱われます。</p>

    <note><title>注</title>

          <p><code>*</code> をシステムの実際の IP アドレスに置き換える
          こともできます。その場合は <code>VirtualHost</code> の引数は
          <code>NameVirtualHost</code> の引数と同じに<em>しなければなりません
          </em>:</p>

            <example>
            NameVirtualHost 172.20.30.40<br />
            <br />
            &lt;VirtualHost 172.20.30.40&gt;<br />
             # etc ...
            </example>

          <p>しかし、IP アドレスが予測不可能なシステム
          ――例えばプロバイダから動的に IP アドレスを取得して何らかの
          ダイナミック DNS を使っている場合など――においては、<code>*</code> 
          指定はさらに便利です。<code>*</code> はすべての IP アドレスに
          マッチしますので、この設定にしておけば IP アドレスが変更されても
          設定変更せずに動作します。</p>
    </note>

    <p>名前ベースのバーチャルホスティングではほぼすべての状況で、
    上記の設定で希望の設定になっていることでしょう。
    実際この設定が動作しないのは、IP アドレスやポートの違いによって
    違うコンテンツを送るときだけです。</p>

    </section>

    <section id="twoips"><title>複数の IP アドレスのあるホストで名前ベースの
    ホスティングを行なう</title>
 
    <note>
    <title>注</title><p>ここで説明されている方法は IP アドレスが
    何個あっても同様にできます。</p>
    </note>

    <p>サーバには二つ IP アドレスがついています。一つ目
    (<code>172.20.30.40</code>) では主サーバ 
    <code>server.domain.com</code> を扱い、もう一方
    (<code>172.20.30.50</code>) では二つかそれ以上の数の
    バーチャルホストを扱います。</p>

    <example>
    <title>サーバの設定</title>

    Listen 80<br />
    <br />
    # This is the "main" server running on 172.20.30.40<br />
    ServerName server.domain.com<br />
    DocumentRoot /www/mainserver<br />
    <br />
    # This is the other address<br />
    NameVirtualHost 172.20.30.50<br />
    <br />
    &lt;VirtualHost 172.20.30.50&gt;<br />
    <indent>
        DocumentRoot /www/example1<br />
        ServerName www.example.com<br />
        <br />
        # Other directives here ...<br />
        <br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.50&gt;<br />
    <indent>
        DocumentRoot /www/example2<br />
        ServerName www.example.org<br />
        <br />
        # Other directives here ...<br />
        <br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    <p><code>172.20.30.50</code> 以外のアドレスへのリクエストは主サーバ
    が扱います。<code>172.20.30.50</code> への、未知のホスト名または
    <code>Host:</code> ヘッダなしのリクエストは <code>www.example.com</code>
    が扱います。</p>

    </section>

    <section id="intraextra"><title>違う IP アドレス (例えば、内部と外部アドレス)
    で同じコンテンツを送る</title>

    <p>サーバマシンは IP アドレスを二つ (<code>192.168.1.1</code>
    と <code>172.20.30.40</code>) 持っています。このマシンは内部
    (イントラネット) と 外部 (インターネット) のネットワークの間に
    あります。<code>server.example.com</code> はネットワークの外からは
    外部アドレス (<code>172.20.30.40</code>) として解決されますが、
    ネットワークの中からは内部アドレス (<code>192.168.1.1</code>) 
    として解決されます。</p>

    <p><code>VirtualHost</code> 一つだけでサーバが内部のリクエストと
    外部のリクエストの両方に同じコンテンツで応答するようにできます。</p>

    <example>
    <title>サーバの設定</title>

    NameVirtualHost 192.168.1.1<br />
    NameVirtualHost 172.20.30.40<br />
    <br />
    &lt;VirtualHost 192.168.1.1 172.20.30.40&gt;<br />
    <indent>
        DocumentRoot /www/server1<br />
        ServerName server.example.com<br />
        ServerAlias server<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    <p>これでどちらのネットワークからのリクエストも同じ <code>VirtualHost</code>
    で扱われるようになります。</p>

    <note><title>注:</title><p>内部ネットワークでは完全なホスト名の
          <code>server.example.com</code> の代わりに、単に <code>server</code>
          を使うことができます。</p>

          <p>上の例では、IP アドレスのリストを、すべてのアドレスに
           同じコンテンツで応答する <code>*</code> に置き換えられます。</p>
    </note>

    </section>

    <section id="port"><title>違うポートで違うサイトを運営する</title>

    <p>同じ IP に複数のドメインがあり、さらに複数のポートを使って
    リクエストを扱いたいときがあります。"NameVirtualHost" タグの中で
    ポートを定義することで、これを動作させられます。
    NameVirtualHost name:port 無しや Listen ディレクティブで
    &lt;VirtualHost name:port&gt; を使おうとしても、その設定は動作しません。</p>

    <example>
    <title>サーバの設定</title>

    Listen 80<br />
    Listen 8080<br />
    <br />
    NameVirtualHost 172.20.30.40:80<br />
    NameVirtualHost 172.20.30.40:8080<br />
    <br />
    &lt;VirtualHost 172.20.30.40:80&gt;<br />
    <indent>
        ServerName www.example.com<br />
        DocumentRoot /www/domain-80<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40:8080&gt;<br />
    <indent>
        ServerName www.example.com<br />
        DocumentRoot /www/domain-8080<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40:80&gt;<br />
    <indent>
        ServerName www.example.org<br />
        DocumentRoot /www/otherdomain-80<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40:8080&gt;<br />
    <indent>
        ServerName www.example.org<br />
        DocumentRoot /www/otherdomain-8080<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    </section>

    <section id="ip"><title>IP ベースのバーチャルホスティング</title>

    <p>サーバは <code>www.example.com</code> と <code>www.example.org</code>
    にそれぞれ解決される、二つの IP アドレス (<code>172.20.30.40</code> と
    <code>172.20.30.50</code>) があります。</p>

    <example>
    <title>サーバの設定</title>

    Listen 80<br />
    <br />
    &lt;VirtualHost 172.20.30.40&gt;<br />
    <indent>
        DocumentRoot /www/example1<br />
        ServerName www.example.com<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.50&gt;<br />
    <indent>
        DocumentRoot /www/example2<br />
        ServerName www.example.org<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    <p><code>&lt;VirtualHost&gt;</code> ディレクティブのどれでも
    指定されていないアドレス (例えば <code>localhost</code>) は、
    主サーバがあればそこに行きます。</p>

    </section>

    <section id="ipport"><title>ポートベースと IP ベースの混ざった
    バーチャルホスト</title>

    <p>サーバマシンはそれぞれ <code>www.example.com</code> と
    <code>www.example.org</code> にそれぞれ解決される、IP アドレスを二つ
    (<code>172.20.30.40</code> と <code>172.20.30.50</code>) 持っています。
    どちらもポート 80 と 8080 でホストを走らせます。</p>

    <example>
    <title>サーバの設定</title>

    Listen 172.20.30.40:80<br />
    Listen 172.20.30.40:8080<br />
    Listen 172.20.30.50:80<br />
    Listen 172.20.30.50:8080<br />
    <br />
    &lt;VirtualHost 172.20.30.40:80&gt;<br />
    <indent>
        DocumentRoot /www/example1-80<br />
        ServerName www.example.com<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40:8080&gt;<br />
    <indent>
        DocumentRoot /www/example1-8080<br />
        ServerName www.example.com<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.50:80&gt;<br />
    <indent>
        DocumentRoot /www/example2-80<br />
        ServerName www.example.org<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.50:8080&gt;<br />
    <indent>
        DocumentRoot /www/example2-8080<br />
        ServerName www.example.org<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    </section>

    <section id="mixed"><title>名前ベースと IP ベースを混ぜた
    バーチャルホスト</title>

    <p>いくつかのマシンでは名前ベースの、その他では IP ベースのバーチャル
    ホストをします。</p>

    <example>
    <title>サーバの設定</title>

    Listen 80<br />
    <br />
    NameVirtualHost 172.20.30.40<br />
    <br />
    &lt;VirtualHost 172.20.30.40&gt;<br />
    <indent>
        DocumentRoot /www/example1<br />
        ServerName www.example.com<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40&gt;<br />
    <indent>
        DocumentRoot /www/example2<br />
        ServerName www.example.org<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40&gt;<br />
    <indent>
        DocumentRoot /www/example3<br />
        ServerName www.example3.net<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    # IP-based<br />
    &lt;VirtualHost 172.20.30.50&gt;<br />
    <indent>
        DocumentRoot /www/example4<br />
        ServerName www.example4.edu<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.60&gt;<br />
    <indent>
        DocumentRoot /www/example5<br />
        ServerName www.example5.gov<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    </section>

    <section id="proxy"><title><code>Virtual_host</code> と
    mod_proxy を併用する</title>

    <p>次の例は、フロント側のバーチャルホストで他のマシンへプロクシします。
    例では <code>192.168.111.2</code> のマシンではバーチャルホスト名は
    同じ名前で設定されています。複数のホスト名を一台のマシンにプロクシする
    場合は、<directive module="mod_proxy">ProxyPreserveHost On</directive>
    ディレクティブを使って、希望のホスト名を渡せるようになります。
    </p>

    <example>
    &lt;VirtualHost *:*&gt;<br />
        ProxyPreserveHost On<br />
        ProxyPass / http://192.168.111.2/<br />
        ProxyPassReverse / http://192.168.111.2/<br />
        ServerName hostname.example.com<br />
    &lt;/VirtualHost&gt;
    </example>

    </section>

    <section id="default"><title><code>_default_</code> のバーチャルホストを
    使う</title> 

    <section id="defaultallports"><title>すべてのポートに対する
    <code>_default_</code> バーチャルホスト</title>

    <p>未指定の IP アドレスとポート、<em>つまり</em>他のバーチャルホストに
    使われていないアドレスとポートの組み合わせ、への<em>すべての</em>リクエストを
    受け取ります。</p>

    <example>
    <title>サーバの設定</title>

    &lt;VirtualHost _default_:*&gt;<br />
    <indent>
        DocumentRoot /www/default<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    <p>このようにワイルドカードのポートでデフォルトのバーチャルホストを
    指定すると、主サーバにリクエストが行くのを防げます。</p>

    <p>デフォルトのバーチャルホストは名前ベースのバーチャルホストに
    使われているアドレスとポートの組に送られたリクエストを扱うことは
    ありません。リクエストが不明な <code>Host:</code> ヘッダやその
    ヘッダがなかったりする場合は基本名前ベースバーチャルホスト (その
    アドレスとポートで設定ファイル中で最初のバーチャルホスト) により
    扱われます。</p>

    <p>どんなリクエストでも <directive module="mod_alias">AliasMatch</directive>
    や <directive module="mod_rewrite">RewriteRule</directive> を使って
    単一の情報ページ (やスクリプト) に書き換えることができます。</p>
    </section>

    <section id="defaultdifferentports"><title>違うポートのための
    <code>_default_</code> バーチャルホスト</title>

    <p>一つめの設定とほぼ同じですが、サーバは複数のポートを listen しており、
    80 番ポートに対して二つめの <code>_default_</code> バーチャルホストを
    設定したい場合です。</p>

    <example>
    <title>サーバの設定</title>

    &lt;VirtualHost _default_:80&gt;<br />
    <indent>
        DocumentRoot /www/default80<br />
        # ...<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost _default_:*&gt;<br />
    <indent>
        DocumentRoot /www/default<br />
        # ...<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    <p>80 番ポートのデフォルトバーチャルホスト (ワイルドカードポートの
    デフォルトバーチャルホストよりも前に書かれていなければ<em>なりません</em>) は
    未指定の IP アドレスに送られたすべてのリクエストを扱います。
    主サーバはリクエストを扱いません。</p>
    </section>

    <section id="defaultoneport"><title>一つのポートに対してだけの
    <code>_default_</code> バーチャルホスト</title>

    <p>80 番ポートにはデフォルトのバーチャルホストが必要で、他の
    バーチャルホストはデフォルトが必要ない場合です。</p>

    <example>
    <title>サーバの設定</title>

    &lt;VirtualHost _default_:80&gt;<br />
    DocumentRoot /www/default<br />
    ...<br />
    &lt;/VirtualHost&gt;
    </example>

    <p>80 番ポートへのアドレス未指定のリクエストはデフォルトのバーチャル
    ホストから送られます。他の未指定のアドレスとポートへのリクエストは
    主サーバから送られます。</p>
    </section>

  </section>

  <section id="migrate"><title>名前ベースのバーチャルホストから IP ベースの
    バーチャルホストに移行する</title>

    <p>ホスト名が名前 <code>www.example.org</code> のバーチャルホスト
    (<a href="#name">名前ベース</a>の例の 2 番目の設定) が専用の IP アドレスを
    得たとします。名前ベースのバーチャルホストの古い IP アドレスを
    キャッシュしているネームサーバやプロキシのために移行期間中は両方の
    バーチャルホストを提供したいとします。</p>

    <p>答は簡単です。単に新しい IP アドレス (<code>172.20.30.50</code>)
    を <code>VirtualHost</code> ディレクティブに追加することで
    できます。</p>
  
    <example>
    <title>サーバ設定</title>

    Listen 80<br />
    ServerName www.example.com<br />
    DocumentRoot /www/example1<br />
    <br />
    NameVirtualHost 172.20.30.40<br />
    <br />
    &lt;VirtualHost 172.20.30.40 172.20.30.50&gt;<br />
    <indent>
        DocumentRoot /www/example2<br />
        ServerName www.example.org<br />
        # ...<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40&gt;<br />
    <indent>
        DocumentRoot /www/example3<br />
        ServerName www.example.net<br />
        ServerAlias *.example.net<br />
        # ...<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    <p>このバーチャルホストは新しいアドレス (IP ベースのバーチャルホストとして)
    と古いアドレス(名前ベースのバーチャルホストとして) の両方から
    アクセスできます。</p>

    </section>

    <section id="serverpath"><title><code>ServerPath</code> ディレクティブを
    使う</title>

    <p>名前ベースのバーチャルホストが二つあるサーバがあるとします。
    正しいバーチャルホストを得るためにはクライアントは正しい
    <code>Host:</code> ヘッダを送らなければなりません。
    古い HTTP/1.0 はそのようなヘッダを送らないので、Apache はクライアントが
    どのバーチャルホストを意図したのかさっぱりわかりません
    (なので、主バーチャルホストでリクエストを扱います)。
    可能な限りの下位互換性を得るため、名前ベースのバーチャルホストの
    URL 接頭辞へのリンクの書かれたページを返す、
    主バーチャルホストが作成されます。</p>

    <example>
    <title>サーバの設定</title>

    NameVirtualHost 172.20.30.40<br />
    <br />
    &lt;VirtualHost 172.20.30.40&gt;<br />
    <indent>
        # primary vhost<br />
        DocumentRoot /www/subdomain<br />
        RewriteEngine On<br />
        RewriteRule ^/.* /www/subdomain/index.html<br />
        # ...<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40&gt;<br />
    DocumentRoot /www/subdomain/sub1<br />
    <indent>
        ServerName www.sub1.domain.tld<br />
        ServerPath /sub1/<br />
        RewriteEngine On<br />
        RewriteRule ^(/sub1/.*) /www/subdomain$1<br />
        # ...<br />
    </indent>
    &lt;/VirtualHost&gt;<br />
    <br />
    &lt;VirtualHost 172.20.30.40&gt;<br />
    <indent>
        DocumentRoot /www/subdomain/sub2<br />
        ServerName www.sub2.domain.tld<br />
        ServerPath /sub2/<br />
        RewriteEngine On<br />
        RewriteRule ^(/sub2/.*) /www/subdomain$1<br />
        # ...<br />
    </indent>
    &lt;/VirtualHost&gt;
    </example>

    <p><directive module="core">ServerPath</directive> ディレクティブの設定に
    より、URL <code>http://www.sub1.domain.tld/sub1/</code> は
    <em>常に</em> sub1-vhost により扱われます。URL
    <code>http://www.sub1.domain.tld/</code> へのリクエストは
    クライアントが正しい <code>Host:</code> ヘッダを送ったときにのみ
    sub1-vhost から送られます。<code>Host:</code> ヘッダがなければ
    クライアントは主ホストの情報ページを得ます。</p>

    <p>一つ奇妙な動作をする点があることは覚えておいてください。
    <code>http://www.sub2.domain.tld/sub1/</code> へのリクエストも
    <code>Host:</code> ヘッダがなければ sub1-vhost により扱われます。</p>

    <p>正しい <code>Host:</code> ヘッダを送ったクライアントはどちらの
    URL、<em>つまり</em>接頭辞がある方も無い方も使えるように
    <directive module="mod_rewrite">RewriteRule</directive> ディレクティブが
    使われています。</p>
  </section>

</manualpage>