Install the ngx_pagespeed module in Nginx 1.9
1. About pagespeed
Ngx_pagespeed is an Nginx extension module that can accelerate your website and reduce page loading time, it automatically applies some practices for improving web performance to webpages and related resources (CSS, JS, and images) without modifying the content and process.
Features:
Image optimization: stripping meta-data, dynamic resizing, recompression
CSS & JavaScript compression and merge
Inline of small resources
Delay image and JS Loading
HTML Rewriting
Extend cache Extension
2. Install
Official Website:
Https://developers.google.com/speed/pagespeed/module/
It has apache and nginx modules.
Https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
Installation Guide.
Apache has not been used for many years. Use nginx. I usually use nginx of openresty.
Http://openresty.org/
First install the dependency Library:
yum install gcc-c++ pcre-devel zlib-devel make unzip
Download nginx of openresty (using a ngx_openresty-1.9.7.1), and then add the pagespeed module above
Pagespeed uses ngx_pagespeed-1.9.32.10-beta
: Https://github.com/pagespeed/ngx_pagespeed/releases
Openresy 1.9 supports the http2 protocol.
./configure --prefix=/usr/local --with-luajit --with-http_stub_status_module --with-http_realip_module --with-http_v2_module --add-module=./ngx_pagespeed-1.9.32.10-beta
Parameter description: Specify the installation directory, add lua module, stat statistics, realip, http2 support, and add the pagespeed module.
Download psol before installation. Otherwise, an error is returned.
ngx_pagespeed: pagespeed optimization library not found: You need to separately download the pagespeed library: $ cd /path/to/ngx_pagespeed $ wget https://dl.google.com/dl/page-speed/psol/1.9.32.10.tar.gz $ tar -xzvf 1.9.32.10.tar.gz # expands to psol/ Or see the installation instructions: https://github.com/pagespeed/ngx_pagespeed#how-to-buildERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \...
Download psol and put it under the ngx_pagespeed directory.
The original connection of this article is: http://blog.csdn.net/freewebsys/article/details/50479176 is not allowed by the blogger can not be reproduced.
The master address is: http://blog.csdn.net/freewebsys
3. Summary
The pagespeed module can automatically compress JavaScript css html, which is super easy to use.
The page is optimized and nginx http2 support is enabled, which is getting faster and faster.
Use lua to develop some simple interception logic. The goal is getting faster and faster.