facebook twitter hatena line email

「Html/パフォーマンスチューニング」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「==解析ツール== GTMetrix http://gtmetrix.com/ Google PageSpeed Insights https://developers.google.com/speed/pagespeed/insights/?hl=ja ==ブラウザのキャッシ...」)
 
行17: 行17:
 
     Header set Cache-Control "max-age=7200, must-revalidate"
 
     Header set Cache-Control "max-age=7200, must-revalidate"
 
  </FilesMatch>
 
  </FilesMatch>
 +
 +
<source>
 +
<<nowiki />FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|gz)$"> # 24weeks
 +
    Header set Cache-Control "max-age=14515200, public"
 +
</FilesMatch>
 +
<<nowiki />FilesMatch "\.(xml|txt)$"> # 2DAYS
 +
    Header set Cache-Control "max-age=172800, public, must-revalidate"
 +
</FilesMatch>
 +
<<nowiki />FilesMatch "\.(html|htm)$"> # 2HOURS
 +
    Header set Cache-Control "max-age=7200, must-revalidate"
 +
</FilesMatch>
 +
</source>
  
 
参考:http://route58.org/tag/htaccess
 
参考:http://route58.org/tag/htaccess

2015年5月21日 (木) 02:01時点における版

解析ツール

GTMetrix http://gtmetrix.com/

Google PageSpeed Insights https://developers.google.com/speed/pagespeed/insights/?hl=ja

ブラウザのキャッシュを利用する

  • .htaccessに追加
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|gz)$"> # 24weeks
    Header set Cache-Control "max-age=14515200, public"
</FilesMatch>
<FilesMatch "\.(xml|txt)$"> # 2DAYS
    Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(html|htm)$"> # 2HOURS
    Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>

<source>

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|gz)$"> # 24weeks
    Header set Cache-Control "max-age=14515200, public"
</FilesMatch>
<FilesMatch "\.(xml|txt)$"> # 2DAYS
    Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(html|htm)$"> # 2HOURS
    Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>

</source>

参考:http://route58.org/tag/htaccess

ファイル圧縮

  • .htaccessに追加
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

参考:http://nelog.jp/compress-components-with-gzip

複数コネクションを同時に処理

  • vi /etc/httpd/conf/extra/xxx.conf
KeepAlive On
MaxKeepAliveRequests 20
KeepAliveTimeout 15

MaxKeepAliveRequestsは1ページあたりの読み込みファイル数+αとする

参考:http://techno-st.net/2009/04/03/keepalive-on-off.html