Nginx (engine-x) is an open-source high-performance HTTP server, reverse proxy, and IMAP/POP3 proxy server. Outstanding features of Nginx include: stable, rich feature sets, simple configuration, and low resource consumption. Nginx is used for some high-performance websites and becomes increasingly popular among webmasters. This tutorial will build an nginx. deb installation package with the GooglePageSpeed module for Ubuntu15.04 from the source code. PageSpee
Nginx (engine-x) is an open-source high-performance HTTP server, reverse proxy, and IMAP/POP3 proxy server. Outstanding features of Nginx include: stable, rich feature sets, simple configuration, and low resource consumption. Nginx is used for some high-performance websites and becomes increasingly popular among webmasters. This tutorial will build an nginx. deb installation package with the Google PageSpeed module for Ubuntu 15.04 from the source code.
PageSpeed is a Web server module developed by Google to accelerate website response time, optimize html, and reduce page loading time. Ngx_pagespeed provides the following functions:
- Image optimization: Remove metadata, Dynamic Scaling, and re-compression.
- CSS and JavaScript compression, concatenation, inline, and external.
- Small resource inline
- Delayed loading of images and JavaScript
- HTML Rewriting
- Cache lifecycle plugin
For more information, see https://developers.google.com/speed/pagespeed/module /.
Prerequisites
- 64-bit Ubuntu Server 15.04
- Root permission
In this article, we will:
- Install necessary software packages
- Install nginx with ngx_pagespeed
- Test
Installation Package
sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev
Install nginx with ngx_pagespeed
Step 1-add an nginx Repository
vim /etc/apt/sources.list.d/nginx.list
Add the following rows:
deb http://nginx.org/packages/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/ubuntu/ trusty nginx
Update Repository:
sudo apt-get update
Note: If you see the information: GPG error [...] NO_PUBKEY [...] and so on
Add key:
sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER
sudo apt-get update
Step 2-download nginx 1.8 From the Repository
sudo su
cd ~
mkdir -p ~/new/nginx_source/
cd ~/new/nginx_source/
apt-get source nginx
apt-get build-dep nginx
Step 3-download Pagespeed
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 4-configure nginx to compile Pagespeed
cd ~/new/nginx_source/nginx-1.8.0/debin/
vim rules
CFLAGS.configure
Add a module:
--add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta \
Adding pagespeed to nginx
Adding pagespeed to nginx
Step 5: Package and install the nginx package
cd ~/new/nginx_source/nginx-1.8.0/
dpkg-buildpackage -b
Dpkg-buildpackage will compile ~ /New/ngix_source/is nginx. deb. After packaging, check the directory:
cd ~/new/ngix_source/
ls
Nginx builded with pagespeed
Then install nginx.
dpkg -i nginx_1.8.0-1~trusty_amd64.deb
Install nginx
Test
Run nginx-V to test whether nginx has built-in ngx_pagespeed.
nginx -V
Nginx-V
Summary
Stable, fast, and open-source nginx supports many different optimization modules. One of these is the 'pagespeed' developed by google '. Unlike apache, The nginx module is not dynamically loaded, so you must select the required module before compiling.
CentOS 6.2 Deployment Nginx + MySQL + PHP http://www.linuxidc.com/Linux/2013-09/90020.htm
Build a WEB server http://www.linuxidc.com/Linux/2013-09/89768.htm with Nginx
Build a Web server http://www.linuxidc.com/Linux/2013-09/89692.htm Based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5
Nginx Performance Tuning http://www.linuxidc.com/Linux/2013-09/89656.htm in CentOS 6.3
Configure Nginx to load ngx_pagespeed module http://www.linuxidc.com/Linux/2013-09/89657.htm under CentOS 6.3
CentOS 6.4 install and configure Nginx + Pcre + php-fpm http://www.linuxidc.com/Linux/2013-08/88984.htm
Nginx installation configuration use notes http://www.linuxidc.com/Linux/2014-07/104499.htm
Nginx log filtering using ngx_log_if does not record specific log http://www.linuxidc.com/Linux/2014-07/104686.htm
Nginx details: Click here
Nginx: Click here
Via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespeed-on-ubuntu-15-04/
Author: Muhammad Arul Translator: geekpi Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-06/119338.htm