apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.37k stars 363 forks source link

again the error: [ngx_pagespeed 1.13.35.2-0] PageSpeed Serf fetch failure rate extremely high; only 0 of 44 recent fetches fully successful; is fetching working? #1563

Open rickygm opened 6 years ago

rickygm commented 6 years ago

Hi again here, but I write to find a solution to this error:

2018/05/17 11:17:16 [error] 1731#5159: [ngx_pagespeed 1.13.35.2-0] PageSpeed Serf fetch failure rate extremely high; only 0 of 44 recent fetches fully successful; is fetching working? 2018/05/17 13:05:20 [error] 1731#5159: [ngx_pagespeed 1.13.35.2-0] PageSpeed Serf fetch failure rate extremely high; only 0 of 44 recent fetches fully successful; is fetching working? 2018/05/17 17:56:56 [error] 1731#5159: [ngx_pagespeed 1.13.35.2-0] PageSpeed Serf fetch failure rate extremely high; only 0 of 89 recent fetches fully successful; is fetching working?

this is my current configuration:

listen 443 ssl http2; server_name myapp.domain.com pagespeed on; pagespeed FetchHttps enable; pagespeed FileCachePath /var/ngx_pagespeed_cache; pagespeed EnableFilters rewrite_css; pagespeed EnableFilters fallback_rewrite_css_urls; pagespeed EnableFilters combine_css; location ~ ".pagespeed.([a-z].)?[a-z]{2}.[^.]{10}.[^.]+" { add_header "" ""; } location ~ "^/ngx_pagespeed_static/" { } location ~ "^/ngx_pagespeed_beacon" { } pagespeed LoadFromFile "https://www.domain.com" "/var/www/webapp/"; pagespeed LoadFromFileRuleMatch disallow .; pagespeed LoadFromFileRuleMatch allow .(ico|pdf|swf|eot|woff|ttf|otf|css|js|jpeg|jpg|png|gif|svg|svgz|mpg|mpeg|mp3|m4a|m4v|mp4|ogg|wmv|mov|mng|3gpp|3gp|webp|webm|flv|avi|asx|asf) (?.)?$;

I hope a little help, I'm not an expert in pagespeed :)

oschaaf commented 6 years ago

In https://github.com/apache/incubator-pagespeed-ngx/issues/1562#issuecomment-389434823 @Lofesa said:

pagespeed LoadFromFileRuleMatch disallow .*; is the rigth statement to disallow all files.

It looks like you didn't try that?

rickygm commented 6 years ago

hi, I have it in my configuration, here is omitting the asterisk , look:

option

Lofesa commented 6 years ago

Hi I use letsencrypt too b but the ssl config diectives I use the standar ssl that comes with centos. I see in your error log that none of the fetches are rigth, that make me think is a missconfiguration. What happend when you try the /?PageSpeedFiltes=+debug (you need to look at the generated html code)?

rickygm commented 6 years ago

Hi Lofesa , you recommend me to put this configuration and remove the one from letsencrypt:

pagespeed SslCertDirectory / etc / pki / tls / certs; pagespeed SslCertFile /etc/pki/tls/cert.pem;

I can not find the correct syntax to debug?

Lofesa commented 6 years ago

Yes, if these paths are valid for your distro, for me are ok on a centos 7. For debug pagespeed, in your browser you can add these params, like https://www.mydomain.com/?PageSpeedFilters=+debug and then look at the generated html code. You can see some debug messages in it.

rickygm commented 6 years ago

Hi Lofesa , I made the change, I'm also using centos 7, debug mode I see many 404 or files that do not exist, I think you have to debug the page and remove links that do not exist.

Is the debug correct? debug

Lofesa commented 6 years ago

Yes, these are the ok params but you need to look not at the network tools on chrome. You need to rigth click on the page and choose to view the html code to see pagespeed debug messages. As I can see you use spanish names to image files: Clica con el boton derecho del raton sobre la pagina, en el menu que se despliega elige "Ver codigo fuente de la pagina". Los mensajes de debug los veras en verde.

rickygm commented 6 years ago

ok , look the debug message: debug1 debug2 debug3 debug4

what do you think of those messages?

regards !

Lofesa commented 6 years ago

Well, these messages are saying that the resources headers don´t let pagespeed rewrite these resources. Or the resources are getting a 404 not found or the resources have a header that are not public cacheable. Pagespeed need the resource public cacheable to work. What Cache-control header have these resources?

rickygm commented 6 years ago

here I do not have it very well tuned the cache with nginx, I'm still making adjustments

proxy_cache_path /var/nginx/ghostcache levels=1:2 keys_zone=ghostcache:10m max_size=300m inactive=24h; proxy_cache_key "$scheme$request_method$host$request_uri"; proxy_cache_methods GET HEAD;

location / { proxy_cache ghostcache; proxy_cache_valid 10m; proxy_cache_valid 404 1m; proxy_cache_purge 1; proxy_ignore_headers Set-Cookie; proxy_hide_header Set-Cookie; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_ignore_headers Cache-Control; add_header X-Cache-Status $upstream_cache_status;

Lofesa commented 6 years ago

Hi Try to comment these param proxy_ignore_headers Cache-Control; and set the header Cache-Control: max-age= in the origin.

rickygm commented 6 years ago

Hi Lofesa , I made the change and added it to the location part

 proxy_hide_header Set-Cookie;
    proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
    add_header Cache-Control "max-age=604800,  public";
    add_header X-Cache-Status $upstream_cache_status;

thank you for your patience, but I have a question here do you need to see something, with this change?

Lofesa commented 6 years ago

Pagespeed need that the resources bacame public cacheable. When you put pagespeed off, the resources must have a cache-control header like that you posted (Cache-Control="max-age=604800, public") You can test it whit https://www.mydomain.com/?PageSpeed=off and look at the headers of resources. In the image you have posted, you have debug messages like