facebook twitter hatena line email

Html/パフォーマンスチューニング/apache

提供: 初心者エンジニアの簡易メモ
2015年5月21日 (木) 05:08時点におけるAdmin (トーク | 投稿記録)による版 (ページの作成:「 ==ブラウザのキャッシュを利用する(apache)== *.htaccessに追加 <<nowiki />FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|gz)$"> # 24weeks He...」)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

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

  • .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>

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

ファイル圧縮(apache)

  • .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