1、安装ModPagespeed
#32位
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm
#64位
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
yum install at
rpm -U mod-pagespeed-*.rpm
2、mod_pagespeed配置
vi /etc/httpd/conf.d/pagespeed.conf
找到包含ModPagespeedEnableFilters的那行,默认情况下是被注释的状态,在其之后添加以下代码:
ModPagespeedEnableFilters rewrite_javascript,rewrite_css
ModPagespeedEnableFilters collapse_whitespace,elide_attributes
ModPagespeedEnableFilters combine_javascript,flatten_css_imports,remove_comments,trim_urls
3、重新启动
service httpd restart
sudo apachectl restart
4、临时禁用PageSpeed组件
http://www.baidu.com/?ModPagespeed=off