发布于 2016-02-08 07:35:32 | 504 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

Apache Web服务器

Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件。


mod_pagespeed是谷歌发布的加速httpd的优化模块,通过自动优化代码、压缩传输内容、自动缓存加速http,支持Centos/Debian系统

mod_pagespeed目前支持Apache和Nginx。Apache中简单的安装方法如下。安装完成之后,它会在yum里新建一个安装源,之后通过yum update更新就可以了

Centos/Fedora下安装


#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

Debina/Ubuntu下安装


#32位
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.deb
#64位
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.deb
dpkg -i mod-pagespeed-*.deb

重启httpd


service httpd restart

查看pagespeed是否加载:


httpd -M|grep pagespeed

配置mod_pagespeed

Tips:mod_pagespeed 需要 Apache 加载 mod_deflate(一个将 web内容gzip压缩后传输的模块)。


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

rpm2cpio ./mod-pagespeed-stable_current_i386.rpm | cpio -idmv
./etc/cron.daily/mod-pagespeed
./etc/httpd/conf.d/pagespeed.conf
./etc/httpd/conf.d/pagespeed_libraries.conf
./usr/bin/pagespeed_js_minify
./usr/lib/httpd/modules/mod_pagespeed.so
./usr/lib/httpd/modules/mod_pagespeed_ap24.so
./var/cache/mod_pagespeed
./var/log/pagespeed
27020 blocks
cp ./usr/lib/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/ #apache版本>=2.4.2,用pagespeed_ap24.so
chmod 0755 /usr/local/apache/modules/mod_pagespeed.so
vim /usr/local/apache/conf/pagespeed.conf #新建配置文件,请根据自己需求修改
LoadModule pagespeed_module /usr/local/apache/modules/mod_pagespeed.so
<IfModule pagespeed_module>
  ModPagespeed on
  ModPagespeedInheritVHostConfig on
  AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
  ModPagespeedFileCachePath      "/var/cache/mod_pagespeed/"
  ModPagespeedFileCacheInodeLimit    500000
  ModPagespeedAvoidRenamingIntrospectiveJavascript on
  ModPagespeedEnableFilters collapse_whitespace
  <Location /mod_pagespeed_beacon>
     SetHandler mod_pagespeed_beacon
  </Location>
  <Location /mod_pagespeed_statistics>
    Order allow,deny
    Allow from localhost
    Allow from 127.0.0.1
    SetHandler mod_pagespeed_statistics
  </Location>
  ModPagespeedMessageBufferSize 100000
 
  <Location /mod_pagespeed_message>
    Allow from localhost
    Allow from 127.0.0.1
    SetHandler mod_pagespeed_message
  </Location>
</IfModule>
mkdir -p /var/mod_pagespeed/
chown -R www.www /var/mod_pagespeed/
echo 'Include conf/pagespeed.conf' >> /usr/local/apache/conf/httpd.conf
/usr/local/apache/bin/apachectl -t
Syntax OK
service httpd restart



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务