Install the ngx_pagespeed module in Nginx 1.9

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.