おもいでばこを 使いこなそう [決定版]「おもいでばこを使いこなそう(決定版)」 6 PASOCOOP おもいでばこを使いこなそう[決定版] 1 “おもいでばこ”とは?
WordPress を使いこなそう
-
Upload
wataru-okamoto -
Category
Technology
-
view
35.540 -
download
0
Transcript of WordPress を使いこなそう
WordPressを使いこなそう
Vol.1
2012.08.24 - wokamoto
2012年8月23日木曜日
自己紹介
Head Cleaner - <head> 部分のお掃除をするプラグイン
OAuth Provider - WordPress を OAuth プロバイダにするプラグイン
WordPress Plugins/JSeries プロジェクトの一員で、主に WordPress のプラグインをつくっています。
http://profiles.wordpress.org/wokamoto2012年8月23日木曜日
WordPress のパフォーマンスチューニング済 AMI "網元" を公開したりしました。
http://ja.megumi-cloud.com/
2012年8月23日木曜日
最近、こんなん書きましたWordPress 高速化&スマート運用
必携ガイド
2012年8月23日木曜日
概要
ボトルネックの特定方法
プラグインを導入した改善手法
サーバサイドの改善方法
WordPress を使ったウェブサイトのパフォーマンス改善について
2012年8月23日木曜日
ボトルネックを探る
2012年8月23日木曜日
遅くなる原因
PHP の処理が遅い
MySQL の処理が遅い
回線速度の問題
2012年8月23日木曜日
PHP の処理が遅い
プラグインやテーマが非効率
無駄に WordPress が動作している
アクセスが多くて、処理が追いついてない
2012年8月23日木曜日
MySQL の処理が遅い
プラグインの詰め込みすぎでクエリーが多い
クエリーが適切にチューニングされていない
MySQL サーバが適切にチューニングされていない
2012年8月23日木曜日
回線速度の問題
画像ファイルなど大きいファイルが多い
CSS, JS の読み込みが多い
外部から読み込んでいる JS が遅い
2012年8月23日木曜日
Debug Bar と Debug Bar Extendar
2012年8月23日木曜日
http://wordpress.org/extend/plugins/debug-bar/
http://wordpress.org/extend/plugins/debug-bar-extender/
2012年8月23日木曜日
インストールしたら wp-config.php
に以下を追加
define('SAVEQUERIES', true);define('WP_DEBUG', true);define('WP_DEBUG_DISPLAY', false);
2012年8月23日木曜日
Debug Bar でボトルネックになっている処理を特定する
2012年8月23日木曜日
Debug Bar の Profiler タブに表示するチェックポイントを追加
<?phpif ( function_exists("dbgx_checkpoint") ) dbgx_checkpoint( $note="注釈" );
?>
2012年8月23日木曜日
WordPress を極力動かさない
2012年8月23日木曜日
存在しないファイルへのアクセスで WordPress が実行してしまう
# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule> # END WordPress
2012年8月23日木曜日
ブラウザ・クローラが存在確認するファイル
/favicon.ico
/apple-touch-icon.png
/robots.txt
/crossdomain.xml
2012年8月23日木曜日
# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME}! !\.(html?|xml|txt|xsl|js|css|jpe?g|png|gif|ico)$RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule> # END WordPress
2012年8月23日木曜日
JavaScript の重複に気をつける
2012年8月23日木曜日
<?php wp_enqueue_script('jquery'); ?>
2012年8月23日木曜日
jQuery だけ Google AJAX
Libraries のモノを使う <?phpwp_deregister_script('jquery');wp_enqueue_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', array(), '1.7.2');?>
2012年8月23日木曜日
静的ファイルに有効期限を設ける
2012年8月23日木曜日
<IfModule mod_expires.c>ExpiresActive OnExpiresDefault "access plus 1 seconds"ExpiresByType text/html "access plus 1 seconds"ExpiresByType image/gif "access plus 30 days"ExpiresByType image/jpeg "access plus 30 days"ExpiresByType image/png "access plus 30 days"ExpiresByType image/x-icon "access plus 30 days"ExpiresByType text/css "access plus 7 days"ExpiresByType text/javascript "access plus 7 days"ExpiresByType application/x-javascript "access plus 7 days"</IfModule>
2012年8月23日木曜日
Expires 設定した時の注意点
wp_enqueue_style( 'my-theme-style', get_template_directory_uri() . '/style.css', array(), date('YmdHis', filemtime(get_template_directory() . '/style.css') ) );
2012年8月23日木曜日
テキストファイルをgzip 圧縮転送する
2012年8月23日木曜日
<IfModule mod_deflate.c>SetOutputFilter DEFLATEBrowserMatch ^Mozilla/4 gzip-only-text/htmlBrowserMatch ^Mozilla/4\.0[678] no-gzipBrowserMatch \bMSIE/[1-6] !no-gzip !gzip-only-text/htmlSetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|ico|pdf)$ no-gzip dont-varySetEnvIfNoCase Request_URI _\.utxt$ no-gzipDeflateCompressionLevel 4AddOutputFilterByType DEFLATE text/plainAddOutputFilterByType DEFLATE text/htmlAddOutputFilterByType DEFLATE text/xmlAddOutputFilterByType DEFLATE text/cssAddOutputFilterByType DEFLATE application/x-javascriptAddOutputFilterByType DEFLATE application/x-httpd-php</IfModule>
2012年8月23日木曜日
.htaccess を極力使わない
2012年8月23日木曜日
/.htaccess
/wp-includes/.htaccess
/wp-includes/js/.htaccess
/wp-includes/js/jquery/.htaccess
/ に対して AllowOverride が有効になっている場合/wp-includes/js/jquery/jquery.js にアクセスがあった際は Apache は以下のファイルをすべて調べる
2012年8月23日木曜日
画像ファイルを最適化する
2012年8月23日木曜日
http://wordpress.org/extend/plugins/wp-smushit/
2012年8月23日木曜日
配信先を複数に分ける
2012年8月23日木曜日
http://wordpress.org/extend/plugins/wp-flickr-press/
2012年8月23日木曜日
http://wordpress.org/extend/plugins/tantan-s3/
2012年8月23日木曜日
CDN を使ってコンテンツを配信する
2012年8月23日木曜日
http://wordpress.org/extend/plugins/wpbooster-cdn-client/
2012年8月23日木曜日
CSS, JS を最適化する
2012年8月23日木曜日
http://wordpress.org/extend/plugins/head-cleaner/
2012年8月23日木曜日
適用前
2012年8月23日木曜日
適用後
2012年8月23日木曜日
WordPress の出力をキャッシュする
2012年8月23日木曜日
Object Cache
2012年8月23日木曜日
よくある WordPress 高速化の手法
<?php bloginfo('stylesheet_url') ?>
テンプレートタグをテーマ中に書くと MySQL サーバにアクセスして遅くなるので URL を直接書こう。
http://example.jp/wp-content/themes/example/style.css
残念ながら、この手法にはあまり効果がありません。
2012年8月23日木曜日
wp_cache_add( $key, $data, $group )
wp_cache_replace( $key, $data, $group )
wp_cache_set( $key, $data, $group )
wp_cache_get( $key, $group )
wp_cache_delete( $key, $group )
wp_cache_flush()
2012年8月23日木曜日
オブジェクトキャッシュされたデータは
通常、毎回破棄される
2012年8月23日木曜日
オブジェクトキャッシュされたデータを永続的に使用するためのプラグイン
http://wordpress.org/extend/plugins/wp-file-cache/
http://wordpress.org/extend/plugins/apc/
http://wordpress.org/extend/plugins/memcached/
2012年8月23日木曜日
DB のクエリー実行結果をキャッシュする
2012年8月23日木曜日
http://wordpress.org/extend/plugins/db-cache-reloaded-fix/
2012年8月23日木曜日
WordPress の出力を丸ごとキャッシュする
2012年8月23日木曜日
http://wordpress.org/extend/plugins/wp-super-cache/
2012年8月23日木曜日
http://wordpress.org/extend/plugins/nginx-champuru/
2012年8月23日木曜日
MySQL のチューニング
2012年8月23日木曜日
$ wget mysqltuner.pl$ chmod +x mysqltuner.pl$ ./mysqltuner.pl
2012年8月23日木曜日
Twitter : @wokamoto
2012年8月23日木曜日