Getting Pagespeed module to work on CentOS httpd server

381 views
Skip to first unread message

lopu designs

unread,
Jan 28, 2017, 10:09:57 PM1/28/17
to mod-pagespeed-discuss
Hello and first of all thank you for building this beautiful piece of software.

I write websites and have a server at 13.54.162.185,

you can view a few of these websites via


I installed pagespeed module today via yum and the conf file has appeared succesfully and I added these lines to my vhost.conf

ModPagespeed On
ModPagespeedInheritVHostConfig on
ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"
ModPagespeedEnableFilters combine_css,combine_javascript
# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
ModPagespeedPreserveUrlRelativity on


NameVirtualHost *:80
<VirtualHost *:80>


       
ServerName default:80
       
ServerAdmin ireply@myleisure.com.au
       
DocumentRoot /var/www/html


</VirtualHost>


<VirtualHost *:80>


        ServerName myleisure.com.au
        ServerAlias myleisure.com.au
        DocumentRoot /
var/www/html/myleisure.com.au
       
Redirect permanent / https://www.myleisure.com.au
       
ServerAdmin ireply@myleisure.com.au

</VirtualHost>



In the docs it tells you to add ModPagespeed on at the top of the pagespeed.conf file, but that line already exists lower down in the file when it checks for the pagespeed_module, I added ModPagespeed on to the top anyway, so I have this line 3 times in total throughout the .conf files now... ?

ModPagespeed on
# Attempt to load mod_version if it wasn't loaded or compiled in (eg on Debian)
<IfModule !mod_version.c>
  LoadModule version_module /usr/lib64/httpd/modules/mod_version.so
</IfModule>

<IfVersion < 2.4>
  LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
  # As default pagespeed.conf configuration uses old-style ACLs using
  # 'allow' and 'deny', we load mod_access_compat in Apache 2.4. If that's a
  # problem, the blocks using that can be converted to the newer 'Require'
  # syntax.
  <IfModule !access_compat_module>
    LoadModule access_compat_module /usr/lib64/httpd/modules/mod_access_compat.$
  </IfModule>

  LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed_ap24.so
</IfVersion>

# Only attempt to load mod_deflate if it hasn't been loaded already.
<IfModule !mod_deflate.c>
 LoadModule deflate_module /usr/lib64/httpd/modules/mod_deflate.so
</IfModule>
<IfModule pagespeed_module>
    # Turn on mod_pagespeed. To completely disable mod_pagespeed, you
    # can set this to "off".
    ModPagespeed on


My question is that pagespeed does not seem to be working for my websites, myleisure and ozledgrowlights are both https websites and no X-etc.. headers come up at all, and on the http websites oly X-Content-Type-Options: nosniff and X-Original-Content-Length: x (actually is the same as Content-Length: x)

So I'm wondering what I might be doing wrong? And if I need to do anything for https or vhosts?

thank you

lopu designs

unread,
Jan 28, 2017, 10:23:07 PM1/28/17
to mod-pagespeed-discuss
So I've just added a few things to my vhost.conf but still no luck

ModPagespeed On
ModPagespeedInheritVHostConfig on
ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"
ModPagespeedEnableFilters combine_css,combine_javascript
# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
ModPagespeedPreserveUrlRelativity on
ModPagespeedFetchHttps enable

ModPagespeedSslCertDirectory /etc/pki/tls/certs
ModPagespeedSslCertFile /etc/pki/tls/cert.pem

lopu designs

unread,
Jan 28, 2017, 10:31:01 PM1/28/17
to mod-pagespeed-discuss
Hmmm when I do pagespeed verification process I don't get the right response

curl -D- 13.54.162.185 | head
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HTTP/1.1 403 Forbidden
Date: Sun, 29 Jan 2017 03:28:33 GMT
Server: Apache/2.4.25 (Amazon) OpenSSL/1.0.1k-fips PHP/5.6.29
Last-Modified: Thu, 19 Jan 2017 16:54:10 GMT
ETag: "131b-5467561d4b080"
Accept-Ranges: bytes
Content-Length: 4891
Content-Type: text/html; charset=UTF-8

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">






On Sunday, 29 January 2017 14:09:57 UTC+11, lopu designs wrote:

Otto van der Schaaf

unread,
Jan 30, 2017, 4:23:41 AM1/30/17
to mod-pagespeed-discuss
When I look at the sites you mentioned, mod_pagespeed seems to be enabled and working on all of them. Except for the last one you mentioned (13.54.162.185) which seems to serve a default response from Apache? 

As that involves a 403/forbidden response, I think mod_pagespeed will not interfere. So you will not see the mod_pagespeed header, and verification via that page will not work.

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/6a6bd363-70cc-46d9-9097-1de5c03d2ae8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lopu designs

unread,
Jan 30, 2017, 4:27:41 AM1/30/17
to mod-pagespeed-discuss
yeah interesting I just changed the config to this, this combination seems to work, have a look at what I turned off. Odd

#ModPagespeed off
#ModPagespeedInheritVHostConfig on
#ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"

# Image Filters
ModPagespeedEnableFilters rewrite_images,insert_image_dimensions,inline_images,$

# CSS Filters
ModPagespeedEnableFilters rewrite_css,move_css_above_scripts,combine_css,inline$

# JS Filters
ModPagespeedEnableFilters rewrite_javascript,canonicalize_javascript_libraries,$

# Misc Filters
ModPagespeedEnableFilters collapse_whitespace,trim_urls,remove_quotes,insert_dn$

# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
# AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
# ModPagespeedPreserveUrlRelativity on
# ModPagespeedFetchHttps enable

ModPagespeedSslCertDirectory /etc/pki/tls/certs
ModPagespeedSslCertFile /etc/pki/tls/cert.pem

<VirtualHost *:80>

        ServerName default:80
        ServerAdmin ire...@myleisure.com.au
        DocumentRoot /var/www/html

</VirtualHost>

# ModPagespeedMapOriginDomain "http://myleisure.com.au" "https://www.myleisure.$

<VirtualHost *:80>

        ServerName myleisure.com.au
        ServerAlias myleisure.com.au
        DocumentRoot /var/www/html/myleisure.com.au
        Redirect permanent / https://www.myleisure.com.au
        ServerAdmin ire...@myleisure.com.au

        <Directory /var/www/html/myleisure.com.au>
        AllowOverride All
        </Directory>
</VirtualHost>

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages