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 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 5 This file is generated from xml source: DO NOT EDIT 6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 7 --> 8<title>mod_expires - Apache HTTP サーバ</title> 9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> 10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> 11<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" /> 12<script src="/style/scripts/prettify.js" type="text/javascript"> 13</script> 14 15<link href="/images/favicon.ico" rel="shortcut icon" /></head> 16<body> 17<div id="page-header"> 18<p class="menu"><a href="/mod/">モジュール</a> | <a href="/mod/directives.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">用語</a> | <a href="/sitemap.html">サイトマップ</a></p> 19<p class="apache">Apache HTTP サーバ バージョン 2.2</p> 20<img alt="" src="/images/feather.gif" /></div> 21<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div> 22<div id="path"> 23<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP サーバ</a> > <a href="http://httpd.apache.org/docs/">ドキュメンテーション</a> > <a href="../">バージョン 2.2</a> > <a href="./">モジュール</a></div> 24<div id="page-content"> 25<div id="preamble"><h1>Apache モジュール mod_expires</h1> 26<div class="toplang"> 27<p><span>翻訳済み言語: </span><a href="/en/mod/mod_expires.html" hreflang="en" rel="alternate" title="English"> en </a> | 28<a href="/ja/mod/mod_expires.html" title="Japanese"> ja </a> | 29<a href="/ko/mod/mod_expires.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> 30</div> 31<div class="outofdate">この日本語訳はすでに古くなっている 32 可能性があります。 33 最近更新された内容を見るには英語版をご覧下さい。 34 </div> 35<table class="module"><tr><th><a href="module-dict.html#Description">説明:</a></th><td>ユーザの指定した基準に基づいた <code>Expires</code> と 36<code>Cache-Control</code> HTTP ヘッダの生成</td></tr> 37<tr><th><a href="module-dict.html#Status">ステータス:</a></th><td>Extension</td></tr> 38<tr><th><a href="module-dict.html#ModuleIdentifier">モジュール識別子:</a></th><td>expires_module</td></tr> 39<tr><th><a href="module-dict.html#SourceFile">ソースファイル:</a></th><td>mod_expires.c</td></tr></table> 40<h3>概要</h3> 41 42 <p>このモジュールはサーバ応答の <code>Expires</code> HTTP ヘッダ 43 と <code>Cache-Control</code> ヘッダの <code>max-age</code> ディレクティブの 44 設定を制御します。元のファイルが作成された時刻または 45 クライアントのアクセス時刻のどちらかに基づいて期限切れ日を 46 設定することができます。</p> 47 48 <p>これらのヘッダはクライアントに文書の 49 有効性と継続性を指示します。文書がキャッシュされた場合には、 50 指定時刻に達するまでは、元の場所から取得する代わりに 51 キャッシュされているものを使うことができます。その後は、 52 キャッシュにあるコピーは期限切れ (expired) で無効であるとされ、 53 元の場所から新しいものを取得する必要があります。</p> 54 55 <p><code>max-age</code> 以外 (<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">RFC 56 2616 section 14.9</a> 参照) の <code>Cache-Control</code> のディレクティブを 57 操作するには <code class="directive"><a href="/mod/mod_headers.html#header">Header</a></code> ディレクティブを 58 使うことができます。</p></div> 59<div id="quickview"><h3 class="directives">ディレクティブ</h3> 60<ul id="toc"> 61<li><img alt="" src="/images/down.gif" /> <a href="#expiresactive">ExpiresActive</a></li> 62<li><img alt="" src="/images/down.gif" /> <a href="#expiresbytype">ExpiresByType</a></li> 63<li><img alt="" src="/images/down.gif" /> <a href="#expiresdefault">ExpiresDefault</a></li> 64</ul> 65<h3>トピック</h3> 66<ul id="topics"> 67<li><img alt="" src="/images/down.gif" /> <a href="#AltSyn">代替期間指定構文</a></li> 68</ul><ul class="seealso"><li><a href="#comments_section">コメント</a></li></ul></div> 69<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 70<div class="section"> 71<h2><a name="AltSyn" id="AltSyn">代替期間指定構文</a></h2> 72 73 <p><code class="directive"><a href="#expiresdefault">ExpiresDefault</a></code> ディレクティブと 74 <code class="directive"><a href="#expiresbytype">ExpiresByType</a></code> ディレクティブは 75 以下のより読み易い構文を使って定義することができます:</p> 76 77 <div class="example"><p><code> 78 ExpiresDefault "<base> [plus] {<num> 79 <type>}*"<br /> 80 ExpiresByType type/encoding "<base> [plus] 81 {<num> <type>}*" 82 </code></p></div> 83 84 <p><base> は以下のどれかです:</p> 85 86 <ul> 87 <li><code>access</code></li> 88 89 <li><code>now</code> ('<code>access</code>' と等価)</li> 90 91 <li><code>modification</code></li> 92 </ul> 93 94 <p><code>plus</code> キーワードは省略可能です。<num> 95 は (<code>atoi()</code> が受け付ける) 整数値、 96 <type> は以下のどれかです:</p> 97 98 <ul> 99 <li><code>years</code></li> 100 <li><code>months</code></li> 101 <li><code>weeks</code></li> 102 <li><code>days</code></li> 103 <li><code>hours</code></li> 104 <li><code>minutes</code></li> 105 <li><code>seconds</code></li> 106 </ul> 107 108 <p>例えば、以下のディレクティブはどれもデフォルトで文書がアクセスの 1 ヶ月後に 109 期限が切れるようにするために使えます:</p> 110 111 <div class="example"><p><code> 112 ExpiresDefault "access plus 1 month"<br /> 113 ExpiresDefault "access plus 4 weeks"<br /> 114 ExpiresDefault "access plus 30 days" 115 </code></p></div> 116 117 <p>期限切れ時刻はいくつか 118 '<num> <type>' 節を追加することでより細かく 119 制御することができます:</p> 120 121 <div class="example"><p><code> 122 ExpiresByType text/html "access plus 1 month 15 123 days 2 hours"<br /> 124 ExpiresByType image/gif "modification plus 5 hours 3 125 minutes" 126 </code></p></div> 127 128 <p>修正時刻に基づいた設定を使用している場合、Expires ヘッダは 129 ディスクのファイル以外のコンテンツには<strong>追加されない</strong>ことに注意 130 してください。そのようなコンテンツには修正時刻は存在しないからです。</p> 131</div> 132<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 133<div class="directive-section"><h2><a name="ExpiresActive" id="ExpiresActive">ExpiresActive</a> <a name="expiresactive" id="expiresactive">ディレクティブ</a></h2> 134<table class="directive"> 135<tr><th><a href="directive-dict.html#Description">説明:</a></th><td><code>Expires</code> ヘッダの生成を有効にする</td></tr> 136<tr><th><a href="directive-dict.html#Syntax">構文:</a></th><td><code>ExpiresActive On|Off</code></td></tr> 137<tr><th><a href="directive-dict.html#Context">コンテキスト:</a></th><td>サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess</td></tr> 138<tr><th><a href="directive-dict.html#Override">上書き:</a></th><td>Indexes</td></tr> 139<tr><th><a href="directive-dict.html#Status">ステータス:</a></th><td>Extension</td></tr> 140<tr><th><a href="directive-dict.html#Module">モジュール:</a></th><td>mod_expires</td></tr> 141</table> 142 <p>このディレクティブは対応するドキュメントの領域で 143 <code>Expires</code> と <code>Cache-Control</code>ヘッダを 144 有効にするか無効にするかを決めます。 145 (例えば、<code>.htaccess</code> ファイルではそのディレクトリの 146 文書のみに適用されるということです。) <code>Off</code> に 147 設定された場合は対応領域でそれらのヘッダは 148 生成されません (<code>.htaccess</code> がサーバ設定ファイルの設定を 149 上書きする、というような下位レベルでの上書きがされていなければ)。 150 <code>On</code> に設定されていれば、ヘッダは <code class="directive"><a href="#expiresbytype">ExpiresByType</a></code> ディレクティブと 151 <code class="directive"><a href="#expiresdefault">ExpiresDefault</a></code> ディレクティブ 152 の基準に従って文書にヘッダを追加します (各ディレクティブ参照)。</p> 153 154 <p>このディレクティブは <code>Expires</code> と 155 <code>Cache-Control</code> ヘッダの存在を 156 保証するわけではないことに注意してください。基準が満たされて 157 いない場合はヘッダは追加されず、結果としてこのディレクティブが 158 指定されていなかったかのようにさえ見えることになります。</p> 159 160</div> 161<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 162<div class="directive-section"><h2><a name="ExpiresByType" id="ExpiresByType">ExpiresByType</a> <a name="expiresbytype" id="expiresbytype">ディレクティブ</a></h2> 163<table class="directive"> 164<tr><th><a href="directive-dict.html#Description">説明:</a></th><td>MIME タイプによって設定される <code>Expires</code> ヘッダの値</td></tr> 165<tr><th><a href="directive-dict.html#Syntax">構文:</a></th><td><code>ExpiresByType <var>MIME-type</var> 166<var><code>seconds</var></code></td></tr> 167<tr><th><a href="directive-dict.html#Context">コンテキスト:</a></th><td>サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess</td></tr> 168<tr><th><a href="directive-dict.html#Override">上書き:</a></th><td>Indexes</td></tr> 169<tr><th><a href="directive-dict.html#Status">ステータス:</a></th><td>Extension</td></tr> 170<tr><th><a href="directive-dict.html#Module">モジュール:</a></th><td>mod_expires</td></tr> 171</table> 172 <p>このディレクティブは指定されたタイプのドキュメント 173 (<em>例えば</em> <code>text/html</code>) 174 に対して生成される <code>Expires</code> ヘッダと <code>Cache-Control</code> 175 ヘッダの <code>max-age</code> ディレクティブの値を定義します。 176 二つ目の引数は期限切れの日時を生成するための基準時刻に追加される 177 秒数を設定します。<code>Cache-Control: 178 max-age</code> は期限切れの時刻からリクエスト時刻を引いたものを秒で 179 表すことで生成されます。</p> 180 181 <p>基準時刻はファイルの最終修正時刻か、クライアントのドキュメントへの 182 アクセス時刻です。どちらを使うべきかは <code><var><code></var></code> 183 によって指定します。<code>M</code> は基準時刻として 184 ファイルの最終修正時刻をという意味で、<code>A</code> はクライアントの 185 アクセス時刻を使うという意味になります。</p> 186 187 <p>効果には微妙な違いがあります。<code>M</code> が使用された場合は、 188 すべてのキャッシュにある現在のドキュメントキャッシュは同時に期限が 189 切れます。これは同じ URL に毎週常に置かれる報せのようなものには 190 非常に有効です。<code>A</code> が使用された場合は、期限切れの 191 時間は各クライアントによって異なります。これはあまり変更されない 192 画像ファイルなど、特に関連するドキュメント群がすべて同じ画像を 193 参照するとき (<em>すなわち</em>画像が比較的短い期間内に繰り返し 194 アクセスされるとき) に有効です。</p> 195 196 <div class="example"><h3>例:</h3><p><code> 197 # enable expirations<br /> 198 ExpiresActive On<br /> 199 # expire GIF images after a month in the client's cache<br /> 200 ExpiresByType image/gif A2592000<br /> 201 # HTML documents are good for a week from the<br /> 202 # time they were changed<br /> 203 ExpiresByType text/html M604800 204 </code></p></div> 205 206 <p>このディレクティブは <code>ExpiresActive On</code> が指定されている 207 ときのみ有効であることに注意してください。これは、 208 指定された MIME タイプに対して<em>のみ</em> <code class="directive"><a href="#expiresdefault">ExpiresDefault</a></code> ディレクティブで 209 設定された期限切れ期日を上書きします。</p> 210 211 <p>この文書の前の方で説明されている<a href="#AltSyn">代替構文</a>を 212 使って期限切れ期日の計算方法を指定することもできます。</p> 213 214</div> 215<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 216<div class="directive-section"><h2><a name="ExpiresDefault" id="ExpiresDefault">ExpiresDefault</a> <a name="expiresdefault" id="expiresdefault">ディレクティブ</a></h2> 217<table class="directive"> 218<tr><th><a href="directive-dict.html#Description">説明:</a></th><td>期限切れ期日を計算するデフォルトアルゴリズム</td></tr> 219<tr><th><a href="directive-dict.html#Syntax">構文:</a></th><td><code>ExpiresDefault <var><code>seconds</var></code></td></tr> 220<tr><th><a href="directive-dict.html#Context">コンテキスト:</a></th><td>サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess</td></tr> 221<tr><th><a href="directive-dict.html#Override">上書き:</a></th><td>Indexes</td></tr> 222<tr><th><a href="directive-dict.html#Status">ステータス:</a></th><td>Extension</td></tr> 223<tr><th><a href="directive-dict.html#Module">モジュール:</a></th><td>mod_expires</td></tr> 224</table> 225 <p>このディレクティブは対応する範囲のすべてのドキュメントに対して 226 デフォルトの期限切れ期日の計算アルゴリズムを設定します。<code class="directive"><a href="#expiresbytype">ExpiresByType</a></code> ディレクティブによって 227 タイプ毎に上書きすることができます。引数の構文はそのディレクティブの 228 説明を参照してください。また、<a href="#AltSyn">代替構文</a>も 229 参照してください。</p> 230 231</div> 232</div> 233<div class="bottomlang"> 234<p><span>翻訳済み言語: </span><a href="/en/mod/mod_expires.html" hreflang="en" rel="alternate" title="English"> en </a> | 235<a href="/ja/mod/mod_expires.html" title="Japanese"> ja </a> | 236<a href="/ko/mod/mod_expires.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> 237</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&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> 238<script type="text/javascript"><!--//--><![CDATA[//><!-- 239var comments_shortname = 'httpd'; 240var comments_identifier = 'http://httpd.apache.org/docs/2.2/mod/mod_expires.html'; 241(function(w, d) { 242 if (w.location.hostname.toLowerCase() == "httpd.apache.org") { 243 d.write('<div id="comments_thread"><\/div>'); 244 var s = d.createElement('script'); 245 s.type = 'text/javascript'; 246 s.async = true; 247 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; 248 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); 249 } 250 else { 251 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); 252 } 253})(window, document); 254//--><!]]></script></div><div id="footer"> 255<p class="apache">Copyright 2013 The Apache Software Foundation.<br />この文書は <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p> 256<p class="menu"><a href="/mod/">モジュール</a> | <a href="/mod/directives.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[//><!-- 257if (typeof(prettyPrint) !== 'undefined') { 258 prettyPrint(); 259} 260//--><!]]></script> 261</body></html>