weixin_39586235
weixin_39586235
2021-01-11 03:09

Wordpress + WP-Super-Cache + GZIP = Error 330

Hello,

I currently have compiled the latest version in my nginx installation and enabled pagespeed with the config lines in the readme file.

Always when I visit the page, it isn't loading anymore - My Googe Chrome just smiles with an 330-error at me: Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.

When I disable the integrated compress function in the WP-Super-Cache plugin it loads, but theres no end with the loading. I see only the title of my site (in the tab), nothing more. Tested on two different wordpress blogs on the same server.

The crazy thing: I still can access to HTTPS sites of the blog - but without the optimized code. A normal & easy PHP site works fine with pagespeed. So I guess it is a Wordpress/plugin issue, but I don't have any idea how to fix it.

My current config:


server {
    listen 80;
    listen 443 ssl spdy;
    listen [::]:80;
        listen [::]:443 ssl spdy;
    ssl_certificate /srv/nginx/ssl/web.crt;
    ssl_certificate_key /srv/nginx/ssl/web.key;
    access_log /var/log/nginx/web-access.log;
        error_log /var/log/nginx/web-error.log;
    server_name www.web;
    return 301 $scheme://web$request_uri;
}

server {

    autoindex off;
    autoindex_localtime on;

        listen 80;
        listen 443 ssl spdy;
        listen [::]:80;
        listen [::]:443 ssl spdy;
    server_name web;

    ssl_certificate /srv/nginx/ssl/web.crt;
    ssl_certificate_key /srv/nginx/ssl/web.key;

    access_log  /var/log/nginx/web-access.log main;
        error_log   /var/log/nginx/web-error.log;

    root /home/www/web;
    index index.php index.html index.htm;

    location ~ \.(css|js|htc)$ {
        expires 31536000s;
        add_header Pragma "public";
        add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    }
    location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
        expires 3600s;
        add_header Pragma "public";
        add_header Cache-Control "max-age=3600, public, must-revalidate, proxy-revalidate";
    }
    location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
        expires 31536000s;
        add_header Pragma "public";
        add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    }

## BEGIN Better WP Security
    location ~ /\.ht { deny all; }
    location ~ wp-config.php { deny all; }
    location ~ readme.html { deny all; }
    location ~ readme.txt { deny all; }
    location ~ /install.php { deny all; }
    set $susquery 0;
    set $rule_2 0;
    set $rule_3 0;
    rewrite ^wp-includes/(.*).php /not_found last;
    rewrite ^/wp-admin/includes(.*)$ /not_found last;
    if ($request_method ~* "^(TRACE|DELETE|TRACK)"){ return 403; }
    if ($http_cookie !~* "wordpress_logged_in_" ) {
        set $susquery 2$susquery;
        set $rule_2 1;
        set $rule_3 1;
    }
    if ($args !~ "^loggedout=true") { set $susquery 3$susquery; }
    rewrite ^/login/?$ /wp-login.php?XXX redirect;
    if ($rule_2 = 1) { rewrite ^/admin/?$ /wp-login.php?4a666djo24byycqanz4kf&redirect_to=/wp-admin/ redirect; }
    if ($rule_2 = 0) { rewrite ^/admin/?$ /wp-admin/?XXX redirect; }
    rewrite ^/register/?$ /wp-login.php?XXX&action=register redirect;
    if ($uri !~ "^(.*)admin-ajax.php") { set $rule_3 2$rule_3; }
    if ($http_referer !~* wp-admin ) { set $rule_3 3$rule_3; }
    if ($http_referer !~* wp-login.php ) { set $rule_3 4$rule_3; }
    if ($http_referer !~* login ) { set $rule_3 5$rule_3; }
    if ($http_referer !~* admin ) { set $rule_3 6$rule_3; }
    if ($http_referer !~* register ) { set $rule_3 7$rule_3; }
    if ($args !~ "^action=logout") { set $rule_3 8$rule_3; }
    if ($args !~ "^XXX") { set $rule_3 9$rule_3; }
    if ($args !~ "^action=rp") { set $rule_3 0$rule_3; }
    if ($args !~ "^action=register") { set $rule_3 a$rule_3; }
    if ($args !~ "^action=postpass") { set $rule_3 b$rule_3; }
    if ($rule_3 = XXX) {
        rewrite ^(.*/)?wp-login.php /not_found redirect;
        rewrite ^/wp-admin(.*)$ /not_found redirect;
    }
## END Better WP Security

    if (!-e $request_filename)
    {
      rewrite ^(.+)$ /index.php?q=$1 last;
    }

    if (-f $request_filename) {
          break;
        }

    #try_files $uri $uri/ /index.php;
    location / {
      try_files $uri $uri/ ;
    }

    location ~ \.(php)$ {
      try_files $uri ;
      fastcgi_pass unix:/etc/php5/fpm/sockets/web.socket;
      fastcgi_param SCRIPT_FILENAME /home/www/web/$fastcgi_script_name;
      include fastcgi_params;
    }

    location ~ /\.ht
        {
          deny all;
        }
}

It also didn't worked, if I remove the "location" rules for better caching.

该提问来源于开源项目:apache/incubator-pagespeed-ngx

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

10条回答

  • weixin_39586235 weixin_39586235 4月前

    Yes, it is working now perfect on my site :) Thanks!

    点赞 评论 复制链接分享
  • weixin_39586235 weixin_39586235 4月前

    Something is still confusing... I have one rating-point less with activated PageSpeed plugin. It says that I should enable GZIP compression... I have activated it by default in the nginx.conf file and it was working before I enabeld pagespeed-mod.

    I also get the suggestion: Header des Typs "Vary: Accept-Encoding" angeben Instructs proxy servers to cache two versions of the resource: one compressed, and one uncompressed. This helps avoid issues with public proxies that do not detect the presence of a Content-Encoding header properly.

    I get this one on all compressed .js files. Is the header automically added to the files or isn't it working for me?

    点赞 评论 复制链接分享
  • weixin_39634132 weixin_39634132 4月前

    Could you send the url for your site to jefftk.com? I want to look and see what's missing what headers.

    点赞 评论 复制链接分享
  • weixin_39586235 weixin_39586235 4月前

    E-Mail sent :)

    点赞 评论 复制链接分享
  • weixin_39634132 weixin_39634132 4月前

    Looking at your site, resources produced by pagespeed aren't being gzipped. No test/css or application/x-javascript. Looking at your site with ?ModPagespeed=off it looks like they are being gzipped when pagespeed is off.

    Could you paste the part of your configuration that deals with gzip?

    点赞 评论 复制链接分享
  • weixin_39586235 weixin_39586235 4月前

    Yes, here's the part of my nginx.conf:

      gzip on;
      gzip_disable "msie6";
      gzip_static on;
      gzip_vary on;
      gzip_proxied any;
      gzip_comp_level 8;
      gzip_buffers 32 64k;
      gzip_http_version 1.1;
      gzip_types application/x-httpd-php text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    Pagespeed also doesn't use Cache-Control. I commented my caching rules out and now Google Pagespeed recommends me to use browser caching. I don't know if its a part of pagespeed to enable Browser caching, but I guess yes :)

    点赞 评论 复制链接分享
  • weixin_39634132 weixin_39634132 4月前

    here's the part of my nginx.conf ...

    That all looks fine. I think ngx_pagespeed is doing something wrong here. I need to look at it more, and probably won't get to that until Monday; sorry!

    doesn't use Cache-Control

    PageSpeed should enable long-caching on your resources, and it looks like it's working on your site: css and js both have Cache-Control:max-age=31536000.

    点赞 评论 复制链接分享
  • weixin_39586235 weixin_39586235 4月前
    That all looks fine. I think ngx_pagespeed is doing something wrong here. I need to look at it more, and probably won't get to that until Monday; sorry!

    No problem :)

    Because the caching topic: That was my own location rules I guess:

     location ~ \.(css|js|htc)$ {
            expires 31536000s;
            add_header Pragma "public";
            add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
        }
        location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
            expires 3600s;
            add_header Pragma "public";
            add_header Cache-Control "max-age=3600, public, must-revalidate, proxy-revalidate";
        }
        location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
            expires 31536000s;
            add_header Pragma "public";
            add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
        }
    

    I commented them out, because I forgot it when I enabled pagespeed to the same time. Now Google-PageSpeed recommends me to enable browser caching.

    点赞 评论 复制链接分享
  • weixin_39586235 weixin_39586235 4月前

    I also noticed that sometimes I get a blank page when I visit my site and I don't know why... It's loading about 30 seconds to get a blank page. Can't say why it happens, because after a reload it works fine again.

    点赞 评论 复制链接分享
  • weixin_39634132 weixin_39634132 4月前

    Could you see if alpha-r2748 fixes this problem? I've updated the readme with installation steps for it.

    点赞 评论 复制链接分享

相关推荐