Centos 6.X LNMP安装ngx_pagespeed
https://github.com/pagespeed/ngx_pagespeedyum install gcc-c++ pcre-dev pcre-devel zlib-devel make
$ cd ~
$ wget https://github.com/pagespeed/ngx_pagespeed/archive/alpha-r2748.zip
$ unzip alpha-r2748.zip
$ # check http://nginx.org/en/download.html for the latest version
$ wget http://nginx.org/download/nginx-1.4.0.tar.gz
$ tar -xvzf nginx-1.4.0.tar.gz
$ cd nginx-1.4.0/
$./configure --add-module=$HOME/ngx_pagespeed-alpha-r2748 \--user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
$ make
$mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
$ cp -r objs/nginx /usr/local/nginx/sbin/nginx
$ kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
$ kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`
$ /usr/local/nginx/sbin/nginx -t
$ /etc/init.d/nginx restart
$ /usr/local/nginx/sbin/nginx -v
修改nginx配置
nginx.conf
在http{}添加
# PageSpeed
pagespeed on;
# let's speed up PageSpeed by storing it in the super duper fast memcached
pagespeed MemcachedThreads 20;
pagespeed MemcachedServers "localhost:11211";
# needs to exist and be writable by nginx
pagespeed FileCachePath /var/ngx_pagespeed_cache;
Vhost下的server{}中添加
# PageSpeed
# Filter settings
pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters collapse_whitespace,remove_comments,combine_css,combine_javascript;
location ~ "\.pagespeed\.(\.)?{2}\.[^.]{10}\.[^.]+" { }
location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
对于DiscuzX的Rewrite修改,下面代码下加上#,不然pagespeed修改的代码会404
#if (!-e $request_filename) {
#return 404;
#} 好东西! 装什么管理软件啊。 秋风 不是一直在论坛里面的吗?我以为才注册的呢 有LAMP方面的优化介绍么? jsy 发表于 2013-5-16 13:31 static/image/common/back.gif
有LAMP方面的优化介绍么?
Apache参考
https://developers.google.com/speed/docs/mod_pagespeed/download
https://developers.google.com/speed/docs/mod_pagespeed/build_mod_pagespeed_from_source 嗯 多谢秋风!:lol 牛~~~~~~~~~~~~~ 多谢秋风
页:
[1]