Nginx (Engine-x) is an open source high-performance HTTP server, reverse proxy and IMAP/POP3 proxy server. Nginx outstanding features are: stable, rich feature set, simple configuration and low resource consumption. Nginx is used in some high-performance websites and becomes more and more popular among stationmaster. This tutorial will build a Nginx. Deb installation package for Ubuntu 15.04 from the source code with the Google paespeed module.
Pagespeed is a Web server module developed by Google to speed up site response times, optimize HTML, and reduce page load times. The functions of Ngx_pagespeed are as follows:
Image optimization: Remove metadata, dynamic scaling, and compression.
CSS and JavaScript compression, concatenation, inline, outreach.
Small resource Inline
Image and JavaScript delay loading
HTML rewrite
Cache life Cycle Plug-in
Predecessor requirements
Ubuntu Server 15.04 64-bit
Root Permissions
In this article we will:
Install prerequisite Packages
Installation of Nginx with Ngx_pagespeed
Test
Install prerequisite Packages
The code is as follows:
sudo apt-get install Dpkg-dev build-essential zlib1g-dev libpcre3
Installation of Nginx with Ngx_pagespeed
First step-Add Nginx Warehouse
The code is as follows:
Vim/etc/apt/sources.list.d/nginx.list
Add the following line:
The code is as follows:
Deb Http://nginx.org/packages/ubuntu/trusty Nginx
DEB-SRC http://nginx.org/packages/ubuntu/trusty Nginx
Update Warehouse:
The code is as follows:
sudo apt-get update
Note: If you see information: GPG error [...] No_pubkey [...] wait a minute.
Please add key:
The code is as follows:
sudo sudo apt-key adv--keyserver keyserver.ubuntu.com--recv-keys keynumber
sudo apt-get update
Step Two-Download Nginx 1.8 from the warehouse
The code is as follows:
sudo su
CD ~
Mkdir-p ~/new/nginx_source/
CD ~/new/nginx_source/
Apt-get Source Nginx
Apt-get BUILD-DEP Nginx
Step three-Download pagespeed
The code is as follows:
CD ~
Mkdir-p ~/new/ngx_pagespeed/
CD ~/new/ngx_pagespeed/
ngx_version=1.9.32.3
wget Https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip
Unzip Release-${ngx_version}-beta.zip
CD ngx_pagespeed-release-1.9.32.3-beta/
wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz
Tar-xzf 1.9.32.3.tar.gz
Step fourth-Configure Nginx to compile Pagespeed
The code is as follows:
CD ~/new/nginx_source/nginx-1.8.0/debin/
VIM rules
Add a module under two cflags. Configure:
--add-module=.. /.. /ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta
Adding Pagespeed to Nginx
Adding Pagespeed to Nginx
Step Fifth-Pack Nginx packages and install
The code is as follows:
CD ~/new/nginx_source/nginx-1.8.0/
Dpkg-buildpackage-b
Dpkg-buildpackage will compile ~/new/ngix_source/as Nginx.deb. After the package is complete, look at the table of contents:
The code is as follows:
CD ~/new/ngix_source/
Ls
Nginx builded with Pagespeed
Then install the Nginx.
The code is as follows:
Dpkg-i Nginx_1.8.0-1~trusty_amd64.deb
Test
Run the NGINX-V test nginx whether the Ngx_pagespeed has been brought in by itself.
The code is as follows:
Nginx-v
Summarize
A stable, fast, open source Nginx supports many different tuning modules. One of these is Google's development of ' pagespeed '. Unlike the Apache,nginx module, which is not dynamically loaded, you must select the desired module before compiling it.