summaryrefslogtreecommitdiff
path: root/docs/manual/configuring.xml.ja
blob: 71b4d942f37ed0a9456aa779ba0f501d9ec6f211 (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
<?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: 420990:1003217 (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="configuring.xml.meta">

  <title>設定ファイル</title>

<summary>
<p>この文書では、Apache HTTP サーバを設定するのに使用するファイルについて
記述しています。</p>
</summary>

  <section id="main">
    <title>メインの設定ファイル</title>
    <related>
      <modulelist>
        <module>mod_mime</module>
      </modulelist>
      <directivelist>
        <directive module="core" type="section">IfDefine</directive>
        <directive module="core">Include</directive>
        <directive module="mod_mime">TypesConfig</directive>
      </directivelist>
    </related>

    <p>Apache は <a href="mod/directives.html"
    >ディレクティブ</a> を設定ファイルに平文で書くことにより設定します。
    メインの設定ファイルは普通は <code>httpd.conf</code> という名前です。
    このファイルの位置はコンパイル時に設定されますが、コマンドラインの
    <code>-f</code> フラグにより上書きできます。
    また、他の設定ファイルを <directive module="core">Include</directive>
    ディレクティブによって追加でき、ワイルドカードを使用して多数の
    設定ファイルを追加することができます。
    どんなディレクティブも、これらの設定ファイルどれにでも入れることができます。
    Apache は起動時か再起動時のみメイン設定ファイルの変更を認識します。</p>

    <p>サーバは MIME
    ドキュメントタイプを含んでいるファイルも読み込みます。ファイル名は
    <directive module="mod_mime">TypesConfig</directive>
    で設定され、デフォルトでは <code>mime.types</code>
    になっています。</p>
  </section>

  <section id="syntax">
    <title>設定ファイルの構文</title>

    <p>Apache の設定ファイルは 1 行に 1 つのディレクティブからなります。
    バックスラッシュ "\" はディレクティブが次の行に継続していることを
    示すために行の最後の文字として使われているかもしれません。
    行の最後とバックスラッシュの間に他の文字や空白があってはいけません。
    </p>

    <p>設定ファイルのディレクティブは大文字小文字を区別しませんが、
    引数にはしばしば区別するものがあります。ハッシュ文字 "#"
    で始まる行はコメントと見なされて無視されます。
    設定ディレクティブと同一行の末尾にコメントが含まれていては<strong
    >いけません</strong>。ディレクティブの前の空行と空白は無視されますので、
    わかりやすくするためにディレクティブをインデントしても構いません。
    </p>

    <p>設定ファイルの構文エラーは、
    <code>apachectl configtest</code>
    かコマンドラインオプション
    <code>-t</code> を使って調べられます。</p>
  </section>

  <section id="modules">
    <title>モジュール</title>

    <related>
      <modulelist>
        <module>mod_so</module>
      </modulelist>
      <directivelist>
        <directive module="core" type="section">IfModule</directive>
        <directive module="mod_so">LoadModule</directive>
      </directivelist>
    </related>

    <p>Apache はモジュール化されたサーバです。
    コアサーバには最も基本的な機能だけが含まれています。拡張機能は
    Apache にロードされる<a href="mod/">モジュール</a
    >として利用可能です。デフォルトでは、コンパイル時にモジュールの
    <a href="mod/module-dict.html#Status">Base</a> セット (基本セット) が
    サーバに含まれます。サーバが<a href="dso.html">動的ロード</a
    >モジュールを使うようにコンパイルされている場合は、
    モジュールを別にコンパイルして、いつでも
    <directive module="mod_so">LoadModule</directive>
    ディレクティブを使って追加できます。
    そうでない場合は、モジュールの追加や削除をするためには Apache
    を再コンパイルする必要があります。設定ディレクティブは <directive
    module="core" type="section">IfModule</directive>
    ブロックに入れることで特定のモジュールが存在するときだけ
    設定ファイルに含まれるようにすることができます。</p>

    <p>コマンドラインオプション <code>-l</code> を使って現時点で
    どのモジュールがサーバにコンパイルされているかを知ることができます。</p>
  </section>

  <section id="scope">
    <title>ディレクティブの適用範囲</title>

    <related>
      <directivelist>
        <directive module="core" type="section">Directory</directive>
        <directive module="core" type="section">DirectoryMatch</directive>
        <directive module="core" type="section">Files</directive>
        <directive module="core" type="section">FilesMatch</directive>
        <directive module="core" type="section">Location</directive>
        <directive module="core" type="section">LocationMatch</directive>
        <directive module="core" type="section">VirtualHost</directive>
      </directivelist>
    </related>

    <p>メイン設定ファイルにあるディレクティブはサーバ全体に適用されます。
    サーバの一部分の設定だけを変更したい場合は <directive module="core"
    type="section">Directory</directive>, <directive module="core"
    type="section">DirectoryMatch</directive>, <directive module="core"
    type="section">Files</directive>, <directive module="core"
    type="section">FilesMatch</directive>, <directive module="core"
    type="section">Location</directive>, <directive module="core"
    type="section">LocationMatch</directive>
    セクションの中に置くことで適用範囲を決められます。
    これらのセクションはその中にあるディレクティブの適用範囲を
    特定のファイルシステムの位置や URL に限定します。
    非常に細粒度の設定を可能にするために、
    セクションを入れ子にすることもできます。</p>

    <p>Apache は同時に多くの違うウェブサイトを扱う能力があります。
    これは <a href="vhosts/">バーチャルホスト</a> と呼ばれています。
    特定のウェブサイトにのみ適用されるようにするために、
    ディレクティブは
    <directive module="core" type="section">VirtualHost</directive>
    セクションの中に置くことでも適用範囲を変えることができます。</p>

    <p>ほとんどのディレクティブはどのセクションにでも書けますが、
    中にはコンテキストによっては意味をなさないものもあります。
    例えば、プロセスの作成を制御しているディレクティブはメインサーバの
    コンテキストにのみ書くことができます。
    どのディレクティブをどのセクションに書くことができるかを知るためには
    ディレクティブの <a href="mod/directive-dict.html#Context"
    >コンテキスト</a> を調べてください。詳しい情報は、
    <a href="sections.html">Directory, Location, Files
    セクションの動作法</a>にあります。</p>
  </section>

  <section id="htaccess">
    <title>.htaccess ファイル</title>

    <related>
      <directivelist>
        <directive module="core">AccessFileName</directive>
        <directive module="core">AllowOverride</directive>
      </directivelist>
    </related>

    <p>Apache ではウェブツリーの中に置かれた特別なファイルを使って
    非中央集権的な設定管理をできます。その特別なファイルは普通は
    <code>.htaccess</code> という名前で、
    <directive module="core">AccessFileName</directive>
    ディレクティブでどんな名前にでも指定できます。
    <code>.htaccess</code>
    ファイルに書かれたディレクティブはファイルを置いた
    ディレクトリとその全てのサブディレクトリに適用されます。
    <code>.htaccess</code> ファイルは、メインの設定ファイルと同じ
    構文を使います。
    <code>.htaccess</code>
    ファイルはすべてのリクエストで読み込まれるため、
    変更はすぐに反映されます。</p>

    <p>どのディレクティブが <code>.htaccess</code>
    ファイルに書けるかを調べるには、ディレクティブの<a
    href="mod/directive-dict.html#Context">コンテキスト</a>
    を調べてください。サーバ管理者はさらにメイン設定ファイルの
    <directive module="core">AllowOverride</directive>
    を設定することでどのディレクティブを <code>.htaccess</code>
    ファイルに書けるようにするかを制御することができます。</p>

    <p><code>.htaccess</code> ファイルに関する詳しい情報は
    <a href="howto/htaccess.html">.htaccess チュートリアル</a>
    を参照してください。</p>
  </section>
</manualpage>