1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
3 <?xml-stylesheet type="text/xsl" href="./style/manual.ja.xsl"?>
4 <!-- English Revision: 420990:1157354 (outdated) -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <manualpage metafile="configuring.xml.meta">
28 <p>この文書では、Apache HTTP サーバを設定するのに使用するファイルについて
33 <title>メインの設定ファイル</title>
36 <module>mod_mime</module>
39 <directive module="core" type="section">IfDefine</directive>
40 <directive module="core">Include</directive>
41 <directive module="mod_mime">TypesConfig</directive>
45 <p>Apache は <a href="mod/directives.html"
46 >ディレクティブ</a> を設定ファイルに平文で書くことにより設定します。
47 メインの設定ファイルは普通は <code>httpd.conf</code> という名前です。
48 このファイルの位置はコンパイル時に設定されますが、コマンドラインの
49 <code>-f</code> フラグにより上書きできます。
50 また、他の設定ファイルを <directive module="core">Include</directive>
51 ディレクティブによって追加でき、ワイルドカードを使用して多数の
53 どんなディレクティブも、これらの設定ファイルどれにでも入れることができます。
54 Apache は起動時か再起動時のみメイン設定ファイルの変更を認識します。</p>
57 ドキュメントタイプを含んでいるファイルも読み込みます。ファイル名は
58 <directive module="mod_mime">TypesConfig</directive>
59 で設定され、デフォルトでは <code>mime.types</code>
64 <title>設定ファイルの構文</title>
66 <p>Apache の設定ファイルは 1 行に 1 つのディレクティブからなります。
67 バックスラッシュ "\" はディレクティブが次の行に継続していることを
68 示すために行の最後の文字として使われているかもしれません。
69 行の最後とバックスラッシュの間に他の文字や空白があってはいけません。
72 <p>設定ファイルのディレクティブは大文字小文字を区別しませんが、
73 引数にはしばしば区別するものがあります。ハッシュ文字 "#"
74 で始まる行はコメントと見なされて無視されます。
75 設定ディレクティブと同一行の末尾にコメントが含まれていては<strong
76 >いけません</strong>。ディレクティブの前の空行と空白は無視されますので、
77 わかりやすくするためにディレクティブをインデントしても構いません。
81 <code>apachectl configtest</code>
83 <code>-t</code> を使って調べられます。</p>
86 <section id="modules">
91 <module>mod_so</module>
94 <directive module="core" type="section">IfModule</directive>
95 <directive module="mod_so">LoadModule</directive>
99 <p>Apache はモジュール化されたサーバです。
100 コアサーバには最も基本的な機能だけが含まれています。拡張機能は
101 Apache にロードされる<a href="mod/">モジュール</a
102 >として利用可能です。デフォルトでは、コンパイル時にモジュールの
103 <a href="mod/module-dict.html#Status">Base</a> セット (基本セット) が
104 サーバに含まれます。サーバが<a href="dso.html">動的ロード</a
105 >モジュールを使うようにコンパイルされている場合は、
107 <directive module="mod_so">LoadModule</directive>
109 そうでない場合は、モジュールの追加や削除をするためには Apache
110 を再コンパイルする必要があります。設定ディレクティブは <directive
111 module="core" type="section">IfModule</directive>
112 ブロックに入れることで特定のモジュールが存在するときだけ
113 設定ファイルに含まれるようにすることができます。</p>
115 <p>コマンドラインオプション <code>-l</code> を使って現時点で
116 どのモジュールがサーバにコンパイルされているかを知ることができます。</p>
120 <title>ディレクティブの適用範囲</title>
124 <directive module="core" type="section">Directory</directive>
125 <directive module="core" type="section">DirectoryMatch</directive>
126 <directive module="core" type="section">Files</directive>
127 <directive module="core" type="section">FilesMatch</directive>
128 <directive module="core" type="section">Location</directive>
129 <directive module="core" type="section">LocationMatch</directive>
130 <directive module="core" type="section">VirtualHost</directive>
134 <p>メイン設定ファイルにあるディレクティブはサーバ全体に適用されます。
135 サーバの一部分の設定だけを変更したい場合は <directive module="core"
136 type="section">Directory</directive>, <directive module="core"
137 type="section">DirectoryMatch</directive>, <directive module="core"
138 type="section">Files</directive>, <directive module="core"
139 type="section">FilesMatch</directive>, <directive module="core"
140 type="section">Location</directive>, <directive module="core"
141 type="section">LocationMatch</directive>
142 セクションの中に置くことで適用範囲を決められます。
143 これらのセクションはその中にあるディレクティブの適用範囲を
144 特定のファイルシステムの位置や URL に限定します。
146 セクションを入れ子にすることもできます。</p>
148 <p>Apache は同時に多くの違うウェブサイトを扱う能力があります。
149 これは <a href="vhosts/">バーチャルホスト</a> と呼ばれています。
150 特定のウェブサイトにのみ適用されるようにするために、
152 <directive module="core" type="section">VirtualHost</directive>
153 セクションの中に置くことでも適用範囲を変えることができます。</p>
155 <p>ほとんどのディレクティブはどのセクションにでも書けますが、
156 中にはコンテキストによっては意味をなさないものもあります。
157 例えば、プロセスの作成を制御しているディレクティブはメインサーバの
159 どのディレクティブをどのセクションに書くことができるかを知るためには
160 ディレクティブの <a href="mod/directive-dict.html#Context"
161 >コンテキスト</a> を調べてください。詳しい情報は、
162 <a href="sections.html">Directory, Location, Files
163 セクションの動作法</a>にあります。</p>
166 <section id="htaccess">
167 <title>.htaccess ファイル</title>
171 <directive module="core">AccessFileName</directive>
172 <directive module="core">AllowOverride</directive>
176 <p>Apache ではウェブツリーの中に置かれた特別なファイルを使って
177 非中央集権的な設定管理をできます。その特別なファイルは普通は
178 <code>.htaccess</code> という名前で、
179 <directive module="core">AccessFileName</directive>
180 ディレクティブでどんな名前にでも指定できます。
181 <code>.htaccess</code>
182 ファイルに書かれたディレクティブはファイルを置いた
183 ディレクトリとその全てのサブディレクトリに適用されます。
184 <code>.htaccess</code> ファイルは、メインの設定ファイルと同じ
186 <code>.htaccess</code>
187 ファイルはすべてのリクエストで読み込まれるため、
190 <p>どのディレクティブが <code>.htaccess</code>
191 ファイルに書けるかを調べるには、ディレクティブの<a
192 href="mod/directive-dict.html#Context">コンテキスト</a>
193 を調べてください。サーバ管理者はさらにメイン設定ファイルの
194 <directive module="core">AllowOverride</directive>
195 を設定することでどのディレクティブを <code>.htaccess</code>
196 ファイルに書けるようにするかを制御することができます。</p>
198 <p><code>.htaccess</code> ファイルに関する詳しい情報は
199 <a href="howto/htaccess.html">.htaccess チュートリアル</a>