Sunday, September 25, 2016

Installing mod_pagespeed (Apache module) on CentOS



I have a CentOS (5.7 Final) system on which I already have Apache (2.2.3) installed.




I have installed mod_pagespeed by following the instructions on: http://code.google.com/speed/page-speed/download.html and got the following while installing:



# rpm -U mod-pagespeed-*.rpm
warning: mod-pagespeed-beta_current_x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 7fac5991
[ OK ] atd: [ OK ]


It does appear to be installed properly:




# apachectl -t -D DUMP_MODULES
Loaded Modules:
...
pagespeed_module (shared)


And I've made the following changes in /etc/httpd/conf.d/pagespeed.conf



Added:




ModPagespeedEnableFilters collapse_whitespace,elide_attributes
ModPagespeedEnableFilters combine_css,rewrite_css,move_css_to_head,inline_css
ModPagespeedEnableFilters rewrite_javascript,inline_javascript
ModPagespeedEnableFilters rewrite_images,insert_img_dimensions
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters remove_quotes,remove_comments

ModPagespeedEnableFilters add_instrumentation



Commented out the following lines in mod_pagespeed_statistics




**# Order allow,deny**
# You may insert other "Allow from" lines to add hosts you want to
# allow to look at generated statistics. Another possibility is
# to comment out the "Order" and "Allow" options from the config
# file, to allow any client that can reach your server to examine
# statistics. This might be appropriate in an experimental setup or
# if the Apache server is protected by a reverse proxy that will

# filter URLs in some fashion.
**# Allow from localhost**
**# Allow from 127.0.0.1**
SetHandler mod_pagespeed_statistics



As a separate note, I'm trying to run the prescribed system tests as specified on google's site, but it gives the following error. I'm averse to updating wget on my server, as I'm sure there's no need for it for the actual module to function correctly.



./system_test.sh www.domain.com

You have the wrong version of wget. 1.12 is required.

Answer



I was running into an issue in my installation of mod_pagespeed on a CentOS system wherein it just refused to work after installation.



It turns out there was a permission/ownership access issue for particular folder(s).



In /var/www/, there existed:



drwxr-xr-x  4 root      root   4096 Dec  8 12:02 mod_pagespeed

drwxr-xr-x 2 root root 4096 Dec 8 12:03 mod_pagespeedcache


I changed the permissions to:



drwxr-xr-x  4 apache    apache 4096 Dec  8 12:02 mod_pagespeed
drwxr-xr-x 4 apache apache 4096 Dec 10 13:10 mod_pagespeedcache


The logs were showing:




...
[Sat Dec 10 13:08:43 2011] [error] [mod_pagespeed 0.10.19.4-1209 @30739] /var/www/mod_pagespeedcache/XAM3DOzfwmGm-DkPVUC7.outputlock:0: creating dir (code=13 Permission denied)
...


Worked fine after that.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...