Mod_pagespeed is running but not optimizing?

3,327 views
Skip to first unread message

noshin javed

unread,
Jan 16, 2017, 8:14:09 PM1/16/17
to mod-pagespeed-discuss
I have installed mod_pagespeed and done no other confirgration. Website check and curl confirms its running. but its not working. Also is it possible to add it to WHM?


  LoadModule version_module /usr/lib64/apache2/modules/mod_version.so
</IfModule>
<IfVersion < 2.4>
  LoadModule pagespeed_module /
usr/lib64/apache2/modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
  LoadModule pagespeed_module /
usr/lib64/apache2/modules/mod_pagespeed_ap24.so
</IfVersion>



<IfModule pagespeed_module>
  ModPagespeed on

  ModPagespeedRespectVary on
  ModPagespeedDisableRewriteOnNoTransform off
  ModPagespeedRewriteLevel PassThrough
  ModPagespeedEnableFilters combine_css,extend_cache,rewrite_images
  ModPagespeedEnableFilters rewrite_css,rewrite_javascript
  AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html

  ModPagespeedFileCachePath            "/var/mod_pagespeed/cache/"

  <Location /mod_pagespeed_beacon>
        SetHandler mod_pagespeed_beacon
 
</Location>
 
<Location /mod_pagespeed_statistics>

      Order allow,deny
      Allow from localhost
      SetHandler mod_pagespeed_statistics
 
</Location>
</IfModule>



System specs
CENTOS 7.3 x86_64
WHM 60.0.35 
Easyapache 4
/etc/apache2/conf.modules.d/456_pagespeed.conf
/usr/lib64/apache2/modules/mod_pagespeed.so
X-Mod-Pagespeed: 1.11.33.4-0



my htaccess code is
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters combine_css
</IfModule>

Otto van der Schaaf

unread,
Jan 17, 2017, 2:46:12 AM1/17/17
to mod-pagespeed-discuss
Hi, 

There are a couple of reasons that may prevent mod_pagespeed from rewriting css, js and images to .pagespeed. urls listed here:

I think the most frequent reason is restrictive cache-control headers. The resolution for that is either serving the css/js/images with less
restrictive cache-control headers, or configuring loading assets directly from disk:


For cPanel WHM there is https://github.com/pagespeed/cpanel

Otto


--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/32a65c5c-907a-4301-9a1b-1af79e205191%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

noshin javed

unread,
Jan 17, 2017, 9:15:37 PM1/17/17
to mod-pagespeed-discuss
Hello 
Thank you so much for the answer @Otto van der Schaaf. I have spent the whole day and night to figuring it out but still no success. 
 
Mod_pagespeed is inserting code <script data-pagespeed-no-defer>//<![CDATA[... ("data-pagespeed-url-hash") in https://deemasfashion.co.uk/  but not combining CSS and JS files.

Is there any other file for configuration  like "456_pagespeed.conf"?
What i am missing?
 
Wordpress site 
HTACCESS code is
<IfModule pagespeed_module>
ModPagespeed on
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters combine_javascript
</IfModule>

/etc/apache2/conf.modules.d/456_pagespeed.conf  CODE is

<IfModule !mod_version.c>
 LoadModule version_module /usr/lib64/apache2/modules/mod_version.so
</IfModule>

<IfVersion < 2.4.2>
 LoadModule pagespeed_module /usr/lib64/apache2/modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
 LoadModule pagespeed_module /usr/lib64/apache2/modules/mod_pagespeed_ap24.so
</IfVersion>

<IfModule pagespeed_module>

  ModPagespeed on
  ModPagespeedRespectVary off
  ModPagespeedEnableFilters combine_css
  ModPagespeedEnableFilters combine_javascript
# ModPagespeedCriticalImagesBeaconEnabled false
# ModPagespeedCombineAcrossPaths off
  ModPagespeedMaxSegmentLength 1024
  ModPagespeedDisableRewriteOnNoTransform off
# ModPagespeedModifyCachingHeaders off
#  ModPagespeedListOutstandingUrlsOnError on

  AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
  ModPagespeedFileCachePath            "/var/mod_pagespeed/cache/"
   ModPagespeedFileCacheSizeKb          102400
   ModPagespeedFileCacheCleanIntervalMs 3600000
   ModPagespeedLRUCacheKbPerProcess     1024
   ModPagespeedLRUCacheByteLimit        16384
   ModPagespeedCssInlineMaxBytes        2048
   ModPagespeedImgInlineMaxBytes        2048
   ModPagespeedJsInlineMaxBytes         2048
   ModPagespeedCssOutlineMinBytes       3000
   ModPagespeedJsOutlineMinBytes        3000



System specs
CENTOS 7.3 x86_64
Apache Version: 2.4.25

Easyapache 4
/etc/apache2/conf.modules.d/456_pagespeed.conf
/usr/lib64/apache2/modules/mod_pagespeed.so
X-Mod-Pagespeed: 1.11.33.4-0

Thanks 

Noshin Javed
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Longinos

unread,
Jan 18, 2017, 3:44:32 AM1/18/17
to mod-pagespeed-discuss
Hi @noshin

Is a cacheabke issue:

When you run https://deemasfashion.co.uk/?PagSpeed=off and see the headers, you got 2 Cache-Control:, 1 whit public, max-age=60 and 1 with max-age=0, no-cache, on css and js files you don´t have Cache-control headers.The filters to work need to be public cacheable, assure you has these headers and try it.
These images get a 404 status:

https://deemasfashion.co.uk/wp-content/uploads/2017/01/Fawn-Embroidered-Organza-Gown-Deep-Pink-Bell-Bottom-Pants-2.jpg

https://deemasfashion.co.uk/wp-content/uploads/2017/01/Light-Yellow-Fully-Embroidered-Shirt-Lehenga-3.jpg

If you run https://deemasfashion.co.uk/?PageSpeedFilters=+debug get a bunch of

<!--deadline_exceeded for filter.....

Perhaps you need to set
ModPagespeedRewriteDeadlinePerFlushMs deadline_value_in_milliseconds

Joshua Marantz

unread,
Jan 18, 2017, 6:49:21 AM1/18/17
to mod-pagespeed-discuss
Longinos is right -- you need to make sure your origin assets are cacheable for at least a minute, preferably 5 or 10, in order for PageSpeed to optimize them.

The reason for this requirement is that otherwise PageSpeed has to check back with the origin every time the optimized resource is served to make sure it hasn't expired, which would be disastrous for latency.  In general, to avoid that problem, PageSpeed will re-fetch an origin resource when its own cached copy is about 80% through its time-to-live.  So if you give it 5 minute cache lifetime, PageSpeed will freshen the resource after 4 minutes to avoid having to serve the unoptimized version.

However, I am not sure it's necessary to adjust the rewrite-deadline.  Adjusting that higher makes it more likely that your HTML will be served with optimized resources on the first view, at the cost of delaying the delivery of HTML to the first client.  However, once the optimized resources are cached server-side, this will not matter.  So it's probably better to let the deadline expire and have PageSpeed optimize the resources in the background.

-Josh

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Longinos

unread,
Jan 18, 2017, 8:04:44 AM1/18/17
to mod-pagespeed-discuss
And I think you need to authorize your own domain with

ModPagespeedDomain https://deemasfashion.co.uk

and permit https fecht with

ModPagespeedFetchHttps enable


El martes, 17 de enero de 2017, 2:14:09 (UTC+1), noshin javed escribió:

noshin javed

unread,
Jan 18, 2017, 9:03:06 AM1/18/17
to mod-pagespeed-discuss
Thank you so much @Longinos  @jmarantz for your time and consideration.

I have added cache header and these 2 lined in modpagespeed config file
  ModPagespeedDomain https://deemasfashion.co.uk
  ModPagespeedDomain https://deemasfashion.com.au
  ModPagespeedFetchHttps enable


 After every CSS its giving <!--deadline_exceeded for filter CacheExtender--> in debugging mode. If i add below line in 456_pagespeed.conf, apache failed to rebuild and didn't start after restart command. ModPagespeedRewriteDeadlinePerFlushMs deadline_value_in_milliseconds

Thanks 

Noshin

Joshua Marantz

unread,
Jan 18, 2017, 9:23:19 AM1/18/17
to mod-pagespeed-discuss
I don't think you need to change the rewrite-deadline.  But I am wondering if you have have a cache in front of your server, so the 'deadline exceeded' messages are captured on the first view and displayed to all clients after that....

If you do want to change the deadline, change it to a number :)  E.g.

ModPagespeedRewriteDeadlinePerFlushMs 200

-Josh

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Longinos

unread,
Jan 18, 2017, 12:12:34 PM1/18/17
to mod-pagespeed-discuss

Also you need to configure
ModPagespeedSslCertDirectory directory
ModPagespeedSslCertFile file
 with proper directory and file where certificates are or configure LoadFromFile as stated here or here too

Longinos

unread,
Jan 18, 2017, 12:20:24 PM1/18/17
to mod-pagespeed-discuss

After some more hits messages about deadline stop but get <!--4xx status code, preventing rewriting of in all resources thus pagespeed is unable to fecht these resources..... some messages in server logs?

noshin javed

unread,
Jan 18, 2017, 8:29:04 PM1/18/17
to mod-pagespeed-discuss
Thanks for your time @jmarantz

I am not using any cache at all. I am only using basic cache code in htaccess.

noshin javed

unread,
Jan 18, 2017, 9:07:53 PM1/18/17
to mod-pagespeed-discuss
Thank you so much @Longinos 

Following your instructions, I have inserted SSL cert directory and cert file path. 

I have set another domain https://jaktorch.com with same content and used cert file and directory for it. The https://deemasfashion.co.uk is using ModPagespeedMapOriginDomain for HTTPS.

Sometimes it gives deadline_exceeded  error and some time <!--4xx status code as you have already seen.

Am i still missing something?

456_pagespeed.conf
  ModPagespeed on
 
ModPagespeedRespectVary off
 
ModPagespeedRewriteLevel PassThrough
 
ModPagespeedEnableFilters combine_css,convert_meta_tags
 
ModPagespeedEnableFilters combine_javascript,convert_jpeg_to_progressive
 
ModPagespeedMaxSegmentLength 1024
 
ModPagespeedDisableRewriteOnNoTransform off
 
ModPagespeedModifyCachingHeaders off
 
ModPagespeedListOutstandingUrlsOnError on

 
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
 
ModPagespeedFileCachePath            "/var/mod_pagespeed/cache/"

 
ModPagespeedFetchHttps enable
 
ModPagespeedDomain https://jaktorch.com
 
ModPagespeedDomain https://deemasfashion.co.uk
 
ModPagespeedMapOriginDomain http://localhost https://deemasfashion.co.uk
 
ModPagespeedSslCertDirectory /var/cpanel/ssl/installed/certs
 
ModPagespeedSslCertFile /var/cpanel/ssl/installed/certs/jaktorch_com_9fca6_0.crt


Virtual Host code for https://deemasfashion.co.uk (recommended code in example by google)
<Directory /var/mod_pagespeed/cache>
<FilesMatch "\.(html|htm)$">
Header unset Etag
Header set Cache-control "max-age=0, no-cache"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|gif|png|js|css)$">
Header unset Etag
Header set Cache-control "public, max-age=600"
</FilesMatch>
</Directory>



Htaccess code for https://jaktorch.com
<IfModule mod_rewrite.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 10 minutes"
ExpiresByType image/jpeg "access plus 10 minutes"
ExpiresByType image/gif "access plus 10 minutes"
ExpiresByType image/png "access plus 10 minutes"
ExpiresByType image/png "access plus 10 minutes"
ExpiresByType text/css "access plus 10 minutes"
ExpiresByType text/x-javascript "access plus 10 minutes"


# END Cache-Control Headers
</IfModule>


<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=600, public"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=600, public"
</FilesMatch>
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=600, public"
</FilesMatch>
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=600, public"
</FilesMatch>

thanks 

Noshin

noshin javed

unread,
Jan 18, 2017, 9:33:53 PM1/18/17
to mod-pagespeed-discuss
Same content exists for HTTP and HTTPS of Jaktorch.com. Pagespeed is combing 2 JS files successfully at the bottom of HTTP version.

Longinos

unread,
Jan 19, 2017, 2:57:25 AM1/19/17
to mod-pagespeed-discuss


Hi @nishin

You has the sites serving http and https --> ModPagespeedDomain http?://jaktorch.com
                                ModPagespeedDomain http?://deemasfashion.co.uk
Headers for caching differ on jacktorch.com and
deemasfashion.co.uk
jacktorch.com
                  <FilesMatch "\.(html|htm|php)$">
                  Header set Cache-Control "max-age=600, public"
                  </FilesMatch>

Longinos

unread,
Jan 19, 2017, 3:28:07 AM1/19/17
to mod-pagespeed-discuss
Sorry I make a mistake and publish an inclomplete response

Some thing is wrong with your cache-control headers. In deemasfashion.co.uk . you post here the config for it but I see html with Cache-Control:
public, max-age=1200 andjs,css and images files w/o any. In Jatorch, html files differs from config but css,js and images files had it as configured

For combine css and js files, you need to set ModPagespeedMaxCombinedCssBytes MaxBytes, where Maxbytes is a number. Default value for this (If I remember) is 2048 that is the max size for combined files is 2Kb (you can see doc here). Same for js files, the param is ModPagespeedMaxCombinedJsBytes MaxBytes (doc). Files greater than that are untouched.

I suggest you to add these filters
 
ModPagespeedEnableFilters rewrite_css
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters rewrite_javascript

and use the same cache and expires headers config in in both sites.

.... and I am curious.... why make short time cache in statics resources?






Longinos

unread,
Jan 19, 2017, 3:46:33 AM1/19/17
to mod-pagespeed-discuss


Sorry, an other mistake.

This
ModPagespeedDomain http?://jaktorch.com
Mod0PagespeedDomain http?://deemasfashion.co.uk

must be


ModPagespeedDomain http*://jaktorch.com
Mod0PagespeedDomain http*://deemasfashion.co.uk

and I suggest you to replace this

ModPagespeedMapOriginDomain http://localhost https://deemasfashion.co.uk


to


pagespeed LoadFromFileMatch "^https?://deemasfashion.co.uk/" "/path/to/root/web/files"; 
pagespeed LoadFromFileMatch "^https?://jacktorch.com/" "/path/to/root/web/files"; pagespeed LoadFromFileRuleMatch disallow .*; pagespeed LoadFromFileRuleMatch allow \.css$; pagespeed LoadFromFileRuleMatch allow \.jpe?g$; pagespeed LoadFromFileRuleMatch allow \.png$; pagespeed LoadFromFileRuleMatch allow \.gif$; pagespeed LoadFromFileRuleMatch allow \.js$;

and any line plus to any file extension you need

Longinos

unread,
Jan 19, 2017, 4:12:24 AM1/19/17
to mod-pagespeed-discuss

And one more thing....

You post here the vhost config for deemasfashion.co.uk and the .httacces for jaktorch.com, but sure you have a vhost config for jaktorch.com and a .httacces for deemasfashion.co.uk, perhaps differences in these 4 files may they explain the differences between the config you post here and the headers I see.

To simplify, why don´t put the cache and expire headers in a commun place of the config files?. In this way you ensure al files of same type have the same headerss

noshin javed

unread,
Jan 19, 2017, 10:03:55 AM1/19/17
to mod-pagespeed-discuss
Hello


I am using Jaktorch.com for experiments so its serving both HTTP and HTTPS. Otherwise there will be only one version present that is HTTPS.


I have inserted same Cache code for both domains (and both versions HTTP and HTTPS ) in Virtual Host and removed it from .htccess.


As you suggested, I have added below filters
ModPagespeedEnableFilters rewrite_css,rewrite_images,rewrite_javascript
ModPagespeedMaxCombinedCssBytes 5000000
ModPagespeedMaxCombinedJsBytes 5000000


I am using wordpress CMS, so there are many folders where CSS, JS and jpgs are located. Still you think that i should apply the below code snipet?
/home/public_html/wp-content/uploads/2017/01/
/home/public_html/wp-content/themes/my-theme/
/home/public_html/wp-content/themes/my-theme/CSS/
/home/public_html/wp-content/themes/my-theme/js/
/home/public_html/wp-content/plugins/my-plugins/assets/css
/home/public_html/wp-content/plugins/my-plugins/assets/ja
and 4 to 5 more 


I will insert this code tonight
pagespeed LoadFromFileMatch "^https?://deemasfashion.co.uk/" "/home/public_html/wp-content/"
pagespeed LoadFromFileMatch "^https?://jacktorch.com/" "/home/public_html/wp-content/"
pagespeed LoadFromFileRuleMatch disallow .*
pagespeed LoadFromFileRuleMatch allow \.css$
pagespeed LoadFromFileRuleMatch allow \.jpe?g$
pagespeed LoadFromFileRuleMatch allow \.png$
pagespeed LoadFromFileRuleMatch allow \.gif$
pagespeed LoadFromFileRuleMatch allow \.js$


 Thanks 

Noshin

noshin javed

unread,
Jan 19, 2017, 10:21:23 AM1/19/17
to mod-pagespeed-discuss
For Jaktorch.com
All content coming from HTTPS, Should i change HTTPS to HTTP in content (like CSS, JS and JPS etc)?

This is the code for pagespeed.conf

<IfModule !mod_version.c>

  LoadModule version_module /usr/lib64/apache2/modules/mod_version.so
</IfModule>


<IfVersion < 2.4>
  LoadModule pagespeed_module /usr/lib64/apache2/modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
  LoadModule pagespeed_module /usr/lib64/apache2/modules/mod_pagespeed_ap24.so
</IfVersion>


<IfModule pagespeed_module>

  ModPagespeed on

  ModPagespeedRespectVary off
  ModPagespeedEnableFilters combine_css,rewrite_css,rewrite_images
  ModPagespeedEnableFilters combine_javascript,rewrite_javascript

  ModPagespeedMaxSegmentLength 1024

  ModPagespeedDisableRewriteOnNoTransform off
  ModPagespeedModifyCachingHeaders off
  ModPagespeedListOutstandingUrlsOnError on
  ModPagespeedMaxCombinedCssBytes 5000000

  ModPagespeedMaxCombinedJsBytes 5000000


  # output handler.

  AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html


  # The ModPagespeedFileCachePath and
  ModPagespeedFileCachePath            "/var/mod_pagespeed/cache/"



  # Override the mod_pagespeed 'rewrite level'. The default level
    ModPagespeedRewriteLevel PassThrough

   








  # ModPagespeedDomain
  ModPagespeedFetchHttps enable

  ModPagespeedDomain http://jaktorch.com
  ModPagespeedDomain https://jaktorch.com
  ModPagespeedDomain http://deemasfashion.co.uk
  ModPagespeedDomain https://deemasfashion.co.uk

  ModPagespeedMapOriginDomain http://localhost https://deemasfashion.co.uk
  ModPagespeedSslCertDirectory /var/cpanel/ssl/installed/certs
  ModPagespeedSslCertFile /var/cpanel/ssl/installed/certs/jaktorch_com_9fca6_0207d_1488239999_ad703b214768c8358462af7ddf19bc91.crt



   ModPagespeedFileCacheSizeKb          102400
   ModPagespeedFileCacheCleanIntervalMs 3600000
   ModPagespeedLRUCacheKbPerProcess     1024
   ModPagespeedLRUCacheByteLimit        16384
   ModPagespeedCssInlineMaxBytes        2048
   ModPagespeedImgInlineMaxBytes        2048
   ModPagespeedJsInlineMaxBytes         2048
   ModPagespeedCssOutlineMinBytes       3000
   ModPagespeedJsOutlineMinBytes        3000


   ModPagespeedStatistics on
   ModPagespeedStatisticsLogging on
   ModPagespeedLogDir /var/log/pagespeed
   
<Location /pagespeed_admin>

   Order allow,deny
   Allow from localhost
   Allow from 127.0.0.1
   SetHandler pagespeed_admin
   
</Location>

I am in Cpanel enviourment so i cannot touch httpd.conf, I have to follow the customization docs of Cpanel. here is the code in Virtualhost
/etc/apache2/conf.d/userdata/ssl/2_4/user/domain
/etc/apache2/conf.d/userdata/std/2_4/user/domain

<Directory /var/mod_pagespeed/cache>

<FilesMatch "\.(html|htm)$">
Header unset Etag
Header set Cache-control "max-age=0, no-cache"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|gif|png|js|css)$">

Header unset Etag
Header set Cache-control "public, max-age=600"
</FilesMatch>
</Directory>


Thanks 

Noshin

Longinos

unread,
Jan 19, 2017, 12:11:57 PM1/19/17
to mod-pagespeed-discuss

Hi @noshin, this no my day
This
pagespeed LoadFromFileMatch "^https?://deemasfashion.co.uk/" "/path/to/root/web/files"; 
pagespeed LoadFromFileMatch "^https?://
jacktorch.com/" "/path/to/root/web/files";
pagespeed LoadFromFileRuleMatch disallow .*;
pagespeed LoadFromFileRuleMatch allow \.css$;
pagespeed LoadFromFileRuleMatch allow \.jpe?g$;
pagespeed LoadFromFileRuleMatch allow \.png$;
pagespeed LoadFromFileRuleMatch allow \.gif$;
pagespeed LoadFromFileRuleMatch allow \.js$;

must be

ModPagespeedLoadFromFile "^https?://deemasfashion.co.uk/" "/path/to/root/web/files";
ModPagespeedLoadFromFile "^https?://jacktorch.com/" "/path/to/root/web/files"; ModPagespeedLoadFromFileRuleMatch disallow .*; ModPagespeedLoadFromFileRuleMatch allow \.css$; ModPagespeedLoadFromFileRuleMatch allow \.jpe?g$; ModPagespeedLoadFromFileRuleMatch allow \.png$; ModPagespeedLoadFromFileRuleMatch allow \.gif$; ModPagespeedLoadFromFileRuleMatch allow \.js$;

Longinos

unread,
Jan 19, 2017, 12:47:43 PM1/19/17
to mod-pagespeed-discuss
What do you mean with

I am using wordpress CMS, so there are many folders where CSS, JS and jpgs are located. Still you think that i should apply the below code snipet?
home/public_html/wp-content/uploads/2017/01/
/home/public_html/wp-content/themes/my-theme/
/home/public_html/wp-content/themes/my-theme/CSS/
/home/public_html/wp-content/themes/my-theme/js/
/home/public_html/wp-content/plugins/my-plugins/assets/css
/home/public_html/wp-content/plugins/my-plugins/assets/js
and 4 to 5 more 

Where do you put these paths?


I you refer to use it in
ModPagespeedLoadFromFileRuleMatch sentences, no. In therse sentences you put file extensions not paths to files.


You say "All content coming from HTTPS, Should i change HTTPS to HTTP in content (like CSS, JS and JPS etc)?"
For this: No. You can acces an HTTP site with HTTPS resources w/o problems bu if you acces an HTTPS site that had HTTP resources (css, img,js...) you get an error of mixed content an in most browser cannot display, thus if your 1s. site is HTTPS resources must be HTTPS too.

Most of the problems come from don´t have cache headers or have it incacheable, I wouls say ALL resources mus have at least this

Header set Cache-control "public, max-age=600"

If you put resources with


Header set Cache-control "max-age=0, no-cache"

you get errors like
<!--Uncacheable content, preventing rewriting of...







Longinos

unread,
Jan 19, 2017, 1:16:07 PM1/19/17
to mod-pagespeed-discuss
More things
<Directory /var/mod_pagespeed/cache>

<FilesMatch "\.(html|htm)$">
Header unset Etag

Header set Cache-control "max-age=0, no-cache"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|gif|png|js|css)$">

Header unset Etag

Header set Cache-control "public, max-age=600"
</FilesMatch>
</Directory>

These cache control headers are set for files in
/var/mod_pagespeed/cache where are cache control hearers for files in /home/public_html/ ?

noshin javed

unread,
Jan 20, 2017, 10:45:18 PM1/20/17
to mod-pagespeed-discuss
Thanks you so much @Longinos. 
this is quite stupid of me. I have set the cache issue and have tested it.

thanks again it working a bit but not correctly  like Gzip  is only 50%, no image compression and no CSS combine working and few more. 
Speed is lower than what i was doing manually. 


Thanks

Noshin


<IfModule pagespeed_module>
  ModPagespeed on
  ModPagespeedRespectVary off
  ModPagespeedEnableFilters combine_css,rewrite_css,inline_css,rewrite_images,move_css_above_scripts
  ModPagespeedEnableFilters combine_javascript,rewrite_javascript,defer_javascript,inline_javascript

  ModPagespeedMaxSegmentLength 1024
  ModPagespeedDisableRewriteOnNoTransform off
  ModPagespeedModifyCachingHeaders off
  ModPagespeedListOutstandingUrlsOnError on
  ModPagespeedMaxCombinedCssBytes 5000000
  ModPagespeedMaxCombinedJsBytes 5000000


  # output handler.
  AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html

  # The ModPagespeedFileCachePath
  ModPagespeedFileCachePath            "/var/mod_pagespeed/cache/"


    ModPagespeedRewriteLevel PassThrough
   
  # ModPagespeedDomain
  ModPagespeedFetchHttps enable
  ModPagespeedDomain http://jaktorch.com
  ModPagespeedDomain https://jaktorch.com
  ModPagespeedDomain http://deemasfashion.co.uk
  ModPagespeedDomain https://deemasfashion.co.uk
  ModPagespeedMapOriginDomain http://localhost https://deemasfashion.co.uk
  ModPagespeedSslCertDirectory /var/cpanel/ssl/installed/certs
  ModPagespeedSslCertFile /var/cpanel/ssl/installed/certs/jaktorch_com_9fca6_0207d_1488239999_ad703b214768c8358462af7ddf19bc91.crt


  # Other defaults (cache sizes and thresholds):

   ModPagespeedFileCacheSizeKb          102400
   ModPagespeedFileCacheCleanIntervalMs 3600000
   ModPagespeedLRUCacheKbPerProcess     1024
   ModPagespeedLRUCacheByteLimit        16384
   ModPagespeedCssInlineMaxBytes        2048
   ModPagespeedImgInlineMaxBytes        2048
   ModPagespeedJsInlineMaxBytes         2048
   ModPagespeedCssOutlineMinBytes       3000
   ModPagespeedJsOutlineMinBytes        3000

   ModPagespeedStatistics on
   ModPagespeedStatisticsLogging on
   ModPagespeedLogDir /var/log/pagespeed
   
<Location /pagespeed_admin>

   Order allow,deny
   Allow from localhost
   Allow from 127.0.0.1
   SetHandler pagespeed_admin
   
</Location>

  ModPagespeedLoadFromFile "https://deemasfashion.co.uk/" "/home/dmg165uk/public_html"
  ModPagespeedLoadFromFile "http://deemasfashion.co.uk/" "/home/dmg165uk/public_html"
  ModPagespeedLoadFromFile "https://jacktorch.com/" "/home/jaktorch/public_html"
  ModPagespeedLoadFromFile "http://jacktorch.com/" "/home/jaktorch/public_html"

  ModPagespeedLoadFromFileRuleMatch disallow .*

  ModPagespeedLoadFromFileRuleMatch allow \.css$
  ModPagespeedLoadFromFileRuleMatch allow \.jpe?g$
  ModPagespeedLoadFromFileRuleMatch allow \.png$
  ModPagespeedLoadFromFileRuleMatch allow \.gif$
  ModPagespeedLoadFromFileRuleMatch allow \.js$
  ModPagespeedLoadFromFileRuleMatch allow \.svg$


Longinos

unread,
Jan 21, 2017, 5:05:06 AM1/21/17
to mod-pagespeed-discuss

Hi Noshin

You get js files rewrited and combined but css files only 1 file is rewrited in all others you get <!--CSS not inlined since it&#39;s bigger than 2048 bytes--><!--CSS rewrite failed: Cannot improve

Perhaps these "rewrite failed" is the reason for not combining these files. Some from pagespeed team, like Otto van der Shaaf or jmaranz, may look at this.

In other hand you get images converted yo webp format when browser is Chrome and get rewrited url when in firefox... this all say me that pagespeed module is working (I have tested https://deemasfashion.co.uk/)

svg files does not get cache-control headers, you must add this file type to the list of files in cache-control directive.
you can delete (or comment) this
ModPagespeedMapOriginDomain http://localhost https://deemasfashion.co.uk

Images does not need to be gziped, if in some test you get the issue that images need compresion, this is another t+ype of compression done at the image itself and this type of stuff are done by modpagespeed.
To gzip resources that are untouched by ModPagespeed you need to set in the proper location in vhost config some like:

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png|svg)$" no-gzip

This make that all resources are gziped unles these file types

About speed.... what about when you put
ModPagespeed off? I think thad speed issues are not related to pagespeed. Try to start the site w/o pagespeed enabled and test the speed then enable pagespeed and restart and test again













Otto van der Schaaf

unread,
Jan 23, 2017, 4:25:33 AM1/23/17
to mod-pagesp...@googlegroups.com
The CSS files are already minified to a level where pagespeed can't improve on it, and the id attributes on the <link> declarations prevent combining them. But if you turn on cache extending for these css files, that will be applied though. The css processing looks OK to me.

The debug-message "4xx status code, preventing rewriting of .... " is a bit confusing here. The 4xx debug messages seem specific to svg files. After fetching them, I think mod_pagespeed will decline further processing because it sees the svg content type in the response. mod_pagespeed is not capable of optimizing svg (yet):

Otto



--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/cf8227ea-4f2a-4651-afba-75bccb7c675f%40googlegroups.com.

Longinos

unread,
Jan 23, 2017, 11:18:27 AM1/23/17
to mod-pagespeed-discuss
Hi Otto

But filter combine css is enabled and not working. It seems that once css files get the "cannot improve" status no furter optimization is done as the js files do.


Otto van der Schaaf

unread,
Jan 23, 2017, 1:33:59 PM1/23/17
to mod-pagespeed-discuss
Link tags that have an id attribute have a relatively high chance of being used in javascript or CSS, 
As such combining them has a chance of breaking layouts or scripts, as the id attribute needs to be discarded in the combining process.

The <link> tags that reference css have id="xxx" attributes declared on them. I think they are not combined because of that.

Otto
Reply all
Reply to author
Forward
0 new messages