Help us understand the problem. What is going on with this article?

サイト速度アップを測る大会でTestMySiteで19秒を4秒へ短縮した施策内容

More than 1 year has passed since last update.

第3回CMSプロレスに参加した際に施した施策。

サーバ

ロリポップスタンダードプラン
あえて共用サーバでどれだけできるかやってみた時間なかったから手持ちの鯖を利用

実ファイル圧縮、Minify

画像(ツール利用)
CSS、JS

ソース最適化

HTML、CSS最適化
余計な記述いらない記述調整、スペースインデント削除など

gzip適用

<ifModule mod_deflate.c>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
        AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
        AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
        AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
        AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp
        AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
        AddOutputFilterByType DEFLATE font/truetype font/opentype
    </IfModule>
</ifModule>

ブラウザキャッシュ適用

<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault                                      "access plus 1 month"

    # CSS
    ExpiresByType text/css                              "access plus 1 year"

    # RSS
    ExpiresByType application/atom+xml                  "access plus 1 hour"
    ExpiresByType application/rdf+xml                   "access plus 1 hour"
    ExpiresByType application/rss+xml                   "access plus 1 hour"

    # データはキャッシュさせない
    ExpiresByType application/json                      "access plus 0 seconds"
    ExpiresByType application/ld+json                   "access plus 0 seconds"
    ExpiresByType application/schema+json               "access plus 0 seconds"
    ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
    ExpiresByType application/xml                       "access plus 0 seconds"
    ExpiresByType text/xml                              "access plus 0 seconds"

    # Favicon
    ExpiresByType image/vnd.microsoft.icon              "access plus 1 week"
    ExpiresByType image/x-icon                          "access plus 1 week"

    # HTML
    ExpiresByType text/html                             "access plus 0 seconds"

    # JavaScript
    ExpiresByType application/javascript                "access plus 1 year"
    ExpiresByType application/x-javascript              "access plus 1 year"
    ExpiresByType text/javascript                       "access plus 1 year"

    # マニフェスト
    ExpiresByType application/manifest+json             "access plus 1 week"
    ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
    ExpiresByType text/cache-manifest                   "access plus 0 seconds"

    # 画像や動画
    ExpiresByType audio/ogg                             "access plus 1 month"
    ExpiresByType image/bmp                             "access plus 1 month"
    ExpiresByType image/gif                             "access plus 1 month"
    ExpiresByType image/jpeg                            "access plus 1 month"
    ExpiresByType image/png                             "access plus 1 month"
    ExpiresByType image/svg+xml                         "access plus 1 month"
    ExpiresByType image/webp                            "access plus 1 month"
    ExpiresByType video/mp4                             "access plus 1 month"
    ExpiresByType video/ogg                             "access plus 1 month"
    ExpiresByType video/webm                            "access plus 1 month"

    # Webフォント

    # Embedded OpenType (EOT)
    ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
    ExpiresByType font/eot                              "access plus 1 month"

    # OpenType
    ExpiresByType font/opentype                         "access plus 1 month"

    # TrueType
    ExpiresByType application/x-font-ttf                "access plus 1 month"

    # Web Open Font Format (WOFF) 1.0
    ExpiresByType application/font-woff                 "access plus 1 month"
    ExpiresByType application/x-font-woff               "access plus 1 month"
    ExpiresByType font/woff                             "access plus 1 month"

    # Web Open Font Format (WOFF) 2.0
    ExpiresByType application/font-woff2                "access plus 1 month"

    # Other
    ExpiresByType text/x-cross-domain-policy            "access plus 1 week"

</IfModule>

CMSからアップロードした画像は圧縮する(ImageUploadUtilityプラグイン使用)

無料プラン

cloudflare(CDN)導入

無料プラン、素敵

cloudflareによるSSL化

これによりHTTPS/2適用

ただCDN無料プラン若干不安定っすね。
有料版にしたら画像optimaizeついてるからそれでどうなるかは不明。
別CDNいれたらどうなるかな。

_shogo_
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away