WP Super Cacheの解説であるreadme.txtを、いいとこ取りで乱暴に和訳した。

主要なところ、自分に興味が有るところだけを抽出して乱暴に訳したのをコピペ。

結構役に立つんじゃないかと思います。

間違っていたら、コメントか @shinichiNまでお願いします。

== Description ==
This plugin generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.
動的なWordPressから静的なhtmlファイルを生成します。htmlファイルが生成されてからは、ウェブサーバはWordPressの重たい処理を実行する代わりにこの静的ファイルを供給します。

The static html files will be served to the vast majority of your users, but because a user’s details are displayed in the comment form after they leave a comment those requests are handled by the legacy caching engine. Static files are served to:
静的ファイルは大部分の閲覧者に対して供給されます。が、ユーザの詳細な情報(訳注:メアドもということか?)がコメントフォームに表示されてしまうことから、コメントの投稿を含むリクエストに対してはレガシーキャッシングによって処理されます。
静的ファイルが供給されるのは以下の場合です:

1. Users who are not logged in.
2. Users who have not left a comment on your blog.
3. Or users who have not viewed a password protected post.
1.非ログインユーザ
2.コメントを残していないユーザ
3.パスワードで保護された投稿を見たことがないユーザ

99% of your visitors will be served static html files. Those users who don’t see the static files will still benefit because they will see different cached files that aren’t quite as efficient but still better than uncached. This plugin will help your server cope with a front page appearance on digg.com or other social networking site.
閲覧者の99%には静的ファイルが供給されます。静的ファイルを供給されないユーザでも効果はあります。別のキャッシュファイルが送られるので(静的ファイルほどじゃないにしてもキャッシュされないよりマシ)。

If for some reason “supercaching” doesn’t work on your server then don’t worry. Caching will still be performed, but every request will require loading the PHP engine. In normal circumstances this isn’t bad at all. Visitors to your site will notice no slowdown or difference. Supercache really comes into it’s own if your server is underpowered, or you’re experiencing heavy traffic.
Super Cached html files will be served more quickly than PHP generated cached files but in every day use, the difference isn’t noticeable.
何らかの理由で「スーパーキャッシング」があなたのサーバでは動かなくても、大丈夫です。キャッシングされます。が、すべてのリクエストでphpが実行されます。一般的な状況ではぜんぜん問題ないです。訪問者は遅いとかなんか違うとか、気がつきません。スーパーキャッシュはサーバが動力不足だったりすごいトラフィックがある時に力を発揮するので。
スーパーキャッシングされたhtmlファイルはphpによって生成されるキャッシュよりも速いのは確かですが、普段使いの場合には違いが分からないのです。

The plugin serves cached files in 3 ways (ranked by speed):
キャッシュのされ方3つを速い順に紹介:

1. Mod_Rewrite. The fastest method is by using Apache mod_rewrite (or whatever similar module your web server supports) to serve “supercached” static html files. This completely bypasses PHP and is extremely quick. If your server is hit by a deluge of traffic it is more likely to cope as the requests are “lighter”. This does require the Apache mod_rewrite module (which is probably installed if you have custom permalinks) and a modification of your .htaccess file. Visits by anonymous or unknown users will be served this way.
1.mod_rewrite。Apacheのmod_rewrite(かそれに似たもの。サーバに依る)を使って、スーパーキャッシング。phpを全く動かさないので爆速です。トラフィックの洪水に遭っている時、うまくやってくれます。Apacheとmod_rewriteモジュールが必須で、.htaccessの編集も必要です。不特定多数のユーザに対して、これが発動してページが表示されます。

2. PHP. Supercached static files can now be served by PHP. The plugin will serve a “supercached” file if it exists and it’s almost as fast as the mod_rewrite method. It’s easier to configure as the .htaccess file doesn’t need to be changed. You still need a custom permalink. You can keep portions of your page dynamic in this caching mode. Your server may not cope as well with a really large amount of traffic. (You’re gaming Digg aren’t you? You’ll need mod_rewrite, the rest of us are ok with PHP!)
2.PHP。スーパーキャッシングされた静的ファイルがPHPによって供給されます。このプラグインがスーパーキャッシングされたファイル(があればそれ)を供給します。1番目の方法とほぼ同じ速さです。.htaccessをいじらなくていいので設定が簡単です。が、カスタムパーマリンクは必要です。You can keep portions of your page dynamic in this caching mode. Your server may not cope as well with a really large amount of traffic. (You’re gaming Digg aren’t you? You’ll need mod_rewrite, the rest of us are ok with PHP!)

3. Legacy caching. This is mainly used to cache pages for known users. These are logged in users, visitors who leave comments or those who should be shown custom per-user data. It’s the most flexible caching method but also the slowest. As each page is different it’s often better not to cache pages for these users at all and avoid legacy caching. Legacy caching will also cache visits by unknown users if this caching mode is selected. You can have dynamic parts to your page in this mode too.
3.レガシーキャッシング。特定のユーザに対して使われます。ログインユーザ、コメントを投稿するビジター、ユーザごとにカスタムされたページを見るような人たちのことです。一番融通が利きますが、遅いです。全部のページが違うわけなので、キャッシュしないほうが大抵の場合はよいくらいで、レガシーキャッシングなんかしないほうがいいのかもです。このモードが選択されている場合は、その他のユーザに対してもキャッシュをします。動的なサイトはこのモードで。

If you’re new to caching use PHP caching. It’s easy to set up and very fast. Avoid legacy caching if you can.
キャッシングが初めてなら、PHPモードを使いましょう。簡単で速いです。レガシーキャッシングは避けよう。

= Recommended Settings =
おすすめ設定

Advanced users will probably want to use mod_rewrite caching, but PHP caching is almost as good and recommended for everyone else. Enable the following:
出来る人達はmod_rewriteを使いたいかもしれないけど、PHPモードでイイですよ。下記を有効化します:

1. PHP caching. PHPモード
2. Compress pages. ページ圧縮
3. Don’t cache pages for known users. 既知のユーザ(ログインとか)はキャッシュじゃなく
4. Cache rebuild. キャッシュリビルド
5. CDN support. CDNサポート
6. Extra homepage checks. 追加のホームページチェック

Garbage collection is the act of cleaning up cache files that are out of date and stale. There’s no correct value for the expiry time but a good starting point is 1800 seconds if you’re not using legacy mode. If you are using that mode start with an expiry time of 600 seconds.
ガベージコレクションというのは、古くなったキャッシュファイルを除去すること。正解はないですが、1800秒がいいでしょう(レガシーキャッシングの場合を除く)。レガシーキャッシングの人は600秒で。

If you are not using legacy mode caching consider deleting the contents of the “Rejected User Agents” text box and allow search engines to create supercache static files.
レガシーキャッシングを使っていないならば、「除外するユーザーエージェント」テキストボックスのコンテンツを削除することを検討しましょう。で、検索エンジンに対してスーパーキャッシングファイルを作ることを許可しましょう。

Likewise, preload as many posts as you can and enable “Preload Mode”. Garbage collection will still occur but it won’t affect the preloaded files. If you don’t care about sidebar widgets updating often set the preload interval to 2880 minutes (2 days) so all your posts aren’t recached very often. When the preload occurs the cache files for the post being refreshed is deleted and then regenerated. Afterwards a garbage collection of all old files is performed to clean out stale cache files.
With preloading on cached files will still be deleted when posts are made or edited or comments made.
同様に、できるだけ多くの投稿をプレロードしてプレロードモードを有効にしましょう。ガベージコレクションは起こりますが、プレロードされたファイルには影響しなくなります。サイドバーウィジェットが頻繁に更新されることを無視できるなら、プレロードの間隔を2880秒=2日間に設定しましょう。そうすれば頻繁にりキャッシュされなくて済みます。プレロード時、リフレッシュされたポストのキャッシュファイルも消されて再生成されます。
Afterwards a garbage collection of all old files is performed to clean out stale cache files.

== Installation ==
== インストール方法 ==
1. You should have the Apache mod mime and mod rewrite modules installed and WordPress custom permalinks (Settings->Permalinks) enabled. PHP safe mode should be disabled. If any of those are missing or off you can still use PHP or legacy caching.
1.Apache mod mimeとmod rewriteモジュール、WordPressのカスタムパーマリンクを有効化、PHPセーフモードじゃないこと。どれかが欠けている場合でも、PHPモードかレガシーキャッシングモードが使える。

2. If you have WP-Cache installed already, please disable it. Edit wp-config.php and make sure the WP_CACHE define is deleted, and remove the files wp-content/wp-cache-config.php and wp-content/advanced-cache.php. These will be recreated when you install this plugin.
2.WP-Cacheプラグインがあるなら無効化。wp-config.phpを編集してWP_CACHEの定義を削除。wp-content/wp-cache-config.php と wp-content/advanced-cache.phpを削除。これらはこっちのプラグインのインストール時に再生成されるので。

3. Upload this directory to your plugins directory. It will create a ‘wp-content/plugins/wp-super-cache/’ directory.
3.アップロード。

4. If you are using WordPress MU or WordPress Multisite you can install the plugin in the ordinary plugins folder and activate it “network wide”.
4.マルチサイトならプラグインフォルダに入れて、ネットワークで有効化が可能。

5. WordPress users should go to their Plugins page and activate “WP Super Cache”.
5.有効化。

6. Now go to Settings->WP Super Cache and enable caching. If you see an error message or a blank screen see the “FAQ” section later in this readme for instructions.
6.設定ページでキャッシングを有効化。エラーメッセージが出たり真っ白に出たらFAQを見ましょう。

7. If you choose “Mod Rewrite caching”, mod_rewrite rules will be inserted into your .htaccess file. Look in your web root directory for this file. It should look similar to this:
7.Mod_Rewriteモードの場合、リライトルールを.htaccessファイルに挿入。ウェブルートで下記のように。

`—————–.htaccess—————–`
`RewriteEngine On`
`RewriteBase /`

`RewriteCond %{REQUEST_METHOD} !=POST`
`RewriteCond %{QUERY_STRING} !.*=.*`
`RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`
`RewriteCond %{HTTP:Accept-Encoding} gzip`
`RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240×320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).*`
`RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f`
`RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]`

`RewriteCond %{REQUEST_METHOD} !=POST`
`RewriteCond %{QUERY_STRING} !.*=.*`
`RewriteCond %{QUERY_STRING} !.*attachment_id=.*`
`RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`
`RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240×320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).*`
`RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f`
`RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]`

`RewriteCond %{REQUEST_FILENAME} !-f`
`RewriteCond %{REQUEST_FILENAME} !-d`
`RewriteRule . /index.php [L]`
`—————–.htaccess—————–`

8. After you have enabled the plugin, look for the file “wp-content/cache/.htaccess”. If it’s not there you must create it. It should read:
8.有効化後、wp-content/cache/.htaccessを探す。なければ下記のように作る。

`# BEGIN supercache`
``
` `
` ForceType text/html`
` FileETag None`
`
`
` AddEncoding gzip .gz`
` AddType text/html .gz`
`
`
``
` SetEnvIfNoCase Request_URI \.gz$ no-gzip`
`
`
``
` Header set Cache-Control ‘max-age=3, must-revalidate’`
`
`
``
` ExpiresActive On`
` ExpiresByType text/html A3`
`
`

`# END supercache`

9. Apache must be configured to allow the modules above. If you receive a “500 internal error” when serving requests to anonymous users you need to dig into your Apache configuration. This configuration in my virtual host works for me:
Apacheでモジュールを有効化する。500 internal errorが出るならApache設定がおかしい。下記のようにする。

``
`AllowOverride All`
`
`

10. wp-content/advanced-cache.php loads the caching engine. This file is generated by the plugin. Make sure the path in the include_once() is correct.
10.wp-content/advanced-cache.phpがキャッシュエンジンをロードします。プラグインが生成するものです。include_once()のパスが正しいことを確認する。

== Frequently Asked Questions ==

= Will comments and other dynamic parts of my blog update immediately? =
コメントやその他の動的コンテンツは即座に更新されるの?

Comments will show as soon as they are moderated, depending on the comment policy of the blog owner. Other dynamic elements on a page may not update unless they are written in Javascript, Flash, Java or another client side browser language. The plugin really produces static html pages. No PHP is executed when those pages are served. “Popularity Contest” is one such plugin that will not work.
コメントは承認されたら即表示されます。
その他の要素は更新されません。JSやフラッシュなどが表示するなら別だけど。PHPは実行されないのです。Popularity Contestプラグインなんかは動きません。

= How do I make certain parts of the page stay dynamic? =
動的コンテンツを動的にしときたいんだけど?
There are 2 ways of doing this. You can use Javascript to draw the part of the page you want to keep dynamic. That’s what Google Adsense and many widgets from external sites do. Or you can use a WP Super Cache tag to do the job but you can’t use mod_rewrite mode caching. You have to switch to PHP or legacy caching.
2つやり方があります。一つはJavaScript。Google Adsenseとかの外部サイトがやってますね。ふたつ目はWP Super Cacheタグを使うやり方ですが、mod_rewriteモードはダメです。PHPモードかレガシーキャッシングモードに変更する必要があります。(このあと説明続くので興味ある人は英語で)

= How do I delay serving the cache until the “init” action fires? =
initアクションくらいは実行されてからキャッシュファイルを送ってくれないか?
Cached files are served before almost all of WordPress is loaded. While that’s great for performance it’s a pain when you want to extend the plugin using a core part of WordPress. Set $wp_super_cache_late_init to “1” in wp-content/wp-cache-config.php and cached files will be served when “init” fires. WordPress and it’s plugins will be loaded now. This is very useful when you are using the mfunc tag in your theme.
キャッシュファイルはWordPressがほぼ動かないうちに供給されちゃいます。パフォーマンス的には便利だけど、WordPressのコアな部分を利用してこのプラグインを拡張したい場合不便。wp-content/wp-cache-config.php の $wp_super_cache_late_initを1にする。そうすると、initアクションの時にキャッシュファイルが供給されるように遅らせることができます。WordPressとプラグインファイルがロードされるわけです。mfunc tagをテーマで使っている時とか、いいですね。

この記事が気に入ったら
フォローしてね!

よかったらシェアしてね!

著者について

コメント

コメントする

目次
閉じる