2016-04-29 13 views
1

私はWordPressのためにビルドしたカスタムテーマに問題がありました。サイトの待ち時間は約20秒+です。WordPressのWebサイトで長時間待っています

私は成功せず、次のことを試してみました:

  • をすべてのプラグインを無効に。
  • テーマからWordPressを含むすべてのスクリプトを削除しました。
  • 別のホストに切り替えました。

誰でも問題が分かると思いますか? Firebugの待機時間はサーバーの応答を待つことを意味しますが、問題を把握することはできません。

Firebug showing long waiting time for page request

+0

文書がロードに時間を取っていますか? –

+0

@PedroLobitoすべてのウェブサイトのページ – Jason

+0

あなたは共有ホスティングまたはvpsを使用していますか? –

答えて

2

あなたは、いくつかの運を持っているこれらの特定のルールを適用する必要があります

  1. 使用W3合計キャッシュプラグイン(それはそのニッチに最適です)、または任意の他のキャッシュプラグイン。
  2. テーマにテーマがある場合は、最適化された画像を使用してください。
  3. すべてのCSSファイルとJavaScriptファイルを圧縮します。
  4. 遅延読み込みプラグインを使用すると、テキストをすばやく読み込むことはできますが、バックグラウンドで画像を読み込むことができます。
  5. ほとんどの場合、ページの読み込み時間を遅くするフレームワークを使用していないことを確認してください。
  6. コンテンツ配信ネットワーク(CDN)を使用します。
  7. 固定リソースにExpiresヘッダーを追加します。
  8. 可能であれば、静的なHTMLを使用して高速に読み込みます。
  9. テーマに不要な余分なコードやファイルがないことを確認してください。
  10. 上記のすべての手順を適用し、ページの最適化手法についてさらに読み、良好で長期的な結果が得られるようにします。
2

これはPHP問題のようです。 PHPをバイパスして実際にそれが問題になっているかどうか確認してみましたか?これをテストするには、Cache Enablerのようなキャッシングプラグインをインストールしてから、元のサーバーにadvanced snippetを実装して、プラグインによって生成されたキャッシュされたHTMLを取得するときにPHPをバイパスすることをお勧めします。

Apacheのための高度なスニペット:

# Start Cache Enabler 
<IfModule mod_rewrite.c> 
RewriteEngine On 

<IfModule mod_mime.c> 
# webp HTML file 
RewriteCond %{REQUEST_URI} /$ 
RewriteCond %{REQUEST_URI} !^/wp-admin/.* 
RewriteCond %{REQUEST_METHOD} !=POST 
RewriteCond %{QUERY_STRING} ="" 
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_ 
RewriteCond %{HTTP:Accept-Encoding} gzip 
RewriteCond %{HTTP:Accept} image/webp 
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index-webp.html.gz -f 
RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index-webp.html.gz [L] 

# gzip HTML file 
RewriteCond %{REQUEST_URI} /$ 
RewriteCond %{REQUEST_URI} !^/wp-admin/.* 
RewriteCond %{REQUEST_METHOD} !=POST 
RewriteCond %{QUERY_STRING} ="" 
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_ 
RewriteCond %{HTTP:Accept-Encoding} gzip 
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz -f 
RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz [L] 

AddType text/html .gz 
AddEncoding gzip .gz 
</IfModule> 

# default HTML file 
RewriteCond %{REQUEST_URI} /$ 
RewriteCond %{REQUEST_URI} !^/wp-admin/.* 
RewriteCond %{REQUEST_METHOD} !=POST 
RewriteCond %{QUERY_STRING} ="" 
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_ 
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html -f 
RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html [L] 
</IfModule> 
# End Cache Enabler 

Nginxは:

server { 

    set $cache_uri $request_uri; 

    # bypass cache if POST requests or URLs with a query string 
    if ($request_method = POST) { 
     set $cache_uri 'nullcache'; 
    } 
    if ($query_string != "") { 
     set $cache_uri 'nullcache'; 
    } 

    # bypass cache if URLs containing the following strings 
    if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { 
     set $cache_uri 'nullcache'; 
    } 

    # bypass cache if the cookies containing the following strings 
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { 
     set $cache_uri 'nullcache'; 
    } 

    # custom sub directory e.g. /blog 
    set $custom_subdir ''; 

    # default html file 
    set $cache_enabler_uri '${custom_subdir}/wp-content/cache/cache-enabler/${http_host}${cache_uri}index.html'; 

    # webp html file 
    if ($http_accept ~* "image/webp") { 
     set $cache_enabler_uri '${custom_subdir}/wp-content/cache/cache-enabler/${http_host}${cache_uri}index-webp.html'; 
    } 

    location/{ 
     gzip_static on; # this directive is not required but recommended 
     try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args; 
    } 

    ... 

} 
関連する問題