1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
4 <!-- English Revision: 420990:1330988 (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 <modulesynopsis metafile="mod_expires.xml.meta">
25 <name>mod_expires</name>
26 <description>ユーザの指定した基準に基づいた <code>Expires</code> と
27 <code>Cache-Control</code> HTTP ヘッダの生成</description>
28 <status>Extension</status>
29 <sourcefile>mod_expires.c</sourcefile>
30 <identifier>expires_module</identifier>
33 <p>このモジュールはサーバ応答の <code>Expires</code> HTTP ヘッダ
34 と <code>Cache-Control</code> ヘッダの <code>max-age</code> ディレクティブの
35 設定を制御します。元のファイルが作成された時刻または
36 クライアントのアクセス時刻のどちらかに基づいて期限切れ日を
40 有効性と継続性を指示します。文書がキャッシュされた場合には、
41 指定時刻に達するまでは、元の場所から取得する代わりに
42 キャッシュされているものを使うことができます。その後は、
43 キャッシュにあるコピーは期限切れ (expired) で無効であるとされ、
44 元の場所から新しいものを取得する必要があります。</p>
46 <p><code>max-age</code> 以外 (<a
47 href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">RFC
48 2616 section 14.9</a> 参照) の <code>Cache-Control</code> のディレクティブを
50 module="mod_headers">Header</directive> ディレクティブを
51 使うことができます。</p></summary>
53 <section id="AltSyn"><title>代替期間指定構文</title>
55 <p><directive module="mod_expires">ExpiresDefault</directive> ディレクティブと
56 <directive module="mod_expires">ExpiresByType</directive> ディレクティブは
57 以下のより読み易い構文を使って定義することができます:</p>
60 ExpiresDefault "<base> [plus] {<num>
62 ExpiresByType type/encoding "<base> [plus]
63 {<num> <type>}*"
66 <p><base> は以下のどれかです:</p>
69 <li><code>access</code></li>
71 <li><code>now</code> ('<code>access</code>' と等価)</li>
73 <li><code>modification</code></li>
76 <p><code>plus</code> キーワードは省略可能です。<num>
77 は (<code>atoi()</code> が受け付ける) 整数値、
78 <type> は以下のどれかです:</p>
81 <li><code>years</code></li>
82 <li><code>months</code></li>
83 <li><code>weeks</code></li>
84 <li><code>days</code></li>
85 <li><code>hours</code></li>
86 <li><code>minutes</code></li>
87 <li><code>seconds</code></li>
90 <p>例えば、以下のディレクティブはどれもデフォルトで文書がアクセスの 1 ヶ月後に
91 期限が切れるようにするために使えます:</p>
94 ExpiresDefault "access plus 1 month"<br />
95 ExpiresDefault "access plus 4 weeks"<br />
96 ExpiresDefault "access plus 30 days"
100 '<num> <type>' 節を追加することでより細かく
104 ExpiresByType text/html "access plus 1 month 15
106 ExpiresByType image/gif "modification plus 5 hours 3
110 <p>修正時刻に基づいた設定を使用している場合、Expires ヘッダは
111 ディスクのファイル以外のコンテンツには<strong>追加されない</strong>ことに注意
112 してください。そのようなコンテンツには修正時刻は存在しないからです。</p>
116 <name>ExpiresActive</name>
117 <description><code>Expires</code> ヘッダの生成を有効にする</description>
118 <syntax>ExpiresActive On|Off</syntax>
119 <contextlist><context>server config</context>
120 <context>virtual host</context><context>directory</context>
121 <context>.htaccess</context></contextlist>
122 <override>Indexes</override>
125 <p>このディレクティブは対応するドキュメントの領域で
126 <code>Expires</code> と <code>Cache-Control</code>ヘッダを
128 (例えば、<code>.htaccess</code> ファイルではそのディレクトリの
129 文書のみに適用されるということです。) <code>Off</code> に
130 設定された場合は対応領域でそれらのヘッダは
131 生成されません (<code>.htaccess</code> がサーバ設定ファイルの設定を
132 上書きする、というような下位レベルでの上書きがされていなければ)。
133 <code>On</code> に設定されていれば、ヘッダは <directive
134 module="mod_expires">ExpiresByType</directive> ディレクティブと
135 <directive module="mod_expires">ExpiresDefault</directive> ディレクティブ
136 の基準に従って文書にヘッダを追加します (各ディレクティブ参照)。</p>
138 <p>このディレクティブは <code>Expires</code> と
139 <code>Cache-Control</code> ヘッダの存在を
140 保証するわけではないことに注意してください。基準が満たされて
141 いない場合はヘッダは追加されず、結果としてこのディレクティブが
142 指定されていなかったかのようにさえ見えることになります。</p>
147 <name>ExpiresByType</name>
148 <description>MIME タイプによって設定される <code>Expires</code> ヘッダの値</description>
149 <syntax>ExpiresByType <var>MIME-type</var>
150 <var><code>seconds</var></syntax>
151 <contextlist><context>server config</context><context>virtual host</context>
152 <context>directory</context><context>.htaccess</context></contextlist>
153 <override>Indexes</override>
156 <p>このディレクティブは指定されたタイプのドキュメント
157 (<em>例えば</em> <code>text/html</code>)
158 に対して生成される <code>Expires</code> ヘッダと <code>Cache-Control</code>
159 ヘッダの <code>max-age</code> ディレクティブの値を定義します。
160 二つ目の引数は期限切れの日時を生成するための基準時刻に追加される
161 秒数を設定します。<code>Cache-Control:
162 max-age</code> は期限切れの時刻からリクエスト時刻を引いたものを秒で
165 <p>基準時刻はファイルの最終修正時刻か、クライアントのドキュメントへの
166 アクセス時刻です。どちらを使うべきかは <code><var><code></var></code>
167 によって指定します。<code>M</code> は基準時刻として
168 ファイルの最終修正時刻をという意味で、<code>A</code> はクライアントの
169 アクセス時刻を使うという意味になります。</p>
171 <p>効果には微妙な違いがあります。<code>M</code> が使用された場合は、
172 すべてのキャッシュにある現在のドキュメントキャッシュは同時に期限が
173 切れます。これは同じ URL に毎週常に置かれる報せのようなものには
174 非常に有効です。<code>A</code> が使用された場合は、期限切れの
175 時間は各クライアントよって異なります。これはあまり変更されない
176 画像ファイルなど、特に関連するドキュメント群がすべて同じ画像を
177 参照するとき (<em>すなわち</em>画像が比較的短い期間内に繰り返し
178 アクセスされるとき) に有効です。</p>
180 <example><title>例:</title>
181 # enable expirations<br />
182 ExpiresActive On<br />
183 # expire GIF images after a month in the client's cache<br />
184 ExpiresByType image/gif A2592000<br />
185 # HTML documents are good for a week from the<br />
186 # time they were changed<br />
187 ExpiresByType text/html M604800
190 <p>このディレクティブは <code>ExpiresActive On</code> が指定されている
191 ときのみ有効であることに注意してください。これは、
192 指定された MIME タイプに対して<em>のみ</em> <directive
193 module="mod_expires">ExpiresDefault</directive> ディレクティブで
194 設定された期限切れ期日を上書きします。</p>
196 <p>この文書の前の方で説明されている<a href="#AltSyn">代替構文</a>を
197 使って期限切れ期日の計算方法を指定することもできます。</p>
202 <name>ExpiresDefault</name>
203 <description>期限切れ期日を計算するデフォルトアルゴリズム</description>
204 <syntax>ExpiresDefault <var><code>seconds</var></syntax>
205 <contextlist><context>server config</context><context>virtual host</context>
206 <context>directory</context><context>.htaccess</context></contextlist>
207 <override>Indexes</override>
210 <p>このディレクティブは対応する範囲のすべてのドキュメントに対して
211 デフォルトの期限切れ期日の計算アルゴリズムを設定します。<directive
212 module="mod_expires">ExpiresByType</directive> ディレクティブによって
213 タイプ毎に上書きすることができます。引数の構文はそのディレクティブの
214 説明を参照してください。また、<a href="#AltSyn">代替構文</a>も