How to install Nginx and GooglePageSpeed in Ubuntu15.04

Source: Internet
Author: User
Tags imap
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
  1. sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev

 

Install nginx with ngx_pagespeed

 

Step 1-add an nginx Repository
  1. vim /etc/apt/sources.list.d/nginx.list

Add the following rows:

  1. deb http://nginx.org/packages/ubuntu/ trusty nginx
  2. deb-src http://nginx.org/packages/ubuntu/ trusty nginx

Update Repository:

  1. sudo apt-get update

Note: If you see the information: GPG error [...] NO_PUBKEY [...] and so on

Add key:

  1. sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER
  2. sudo apt-get update

 

Step 2-download nginx 1.8 From the Repository
  1. sudo su
  2. cd ~
  3. mkdir -p ~/new/nginx_source/
  4. cd ~/new/nginx_source/
  5. apt-get source nginx
  6. apt-get build-dep nginx

 

Step 3-download Pagespeed
  1. cd ~
  2. mkdir -p ~/new/ngx_pagespeed/
  3. cd ~/new/ngx_pagespeed/
  4. ngx_version=1.9.32.3
  5. wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip
  6. unzip release-${ngx_version}-beta.zip
  7. cd ngx_pagespeed-release-1.9.32.3-beta/
  8. wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz
  9. tar -xzf 1.9.32.3.tar.gz

 

Step 4-configure nginx to compile Pagespeed
  1. cd ~/new/nginx_source/nginx-1.8.0/debin/
  2. vim rules

CFLAGS.configureAdd a module:

  1. --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
  1. cd ~/new/nginx_source/nginx-1.8.0/
  2. dpkg-buildpackage -b

Dpkg-buildpackage will compile ~ /New/ngix_source/is nginx. deb. After packaging, check the directory:

  1. cd ~/new/ngix_source/
  2. ls

Nginx builded with pagespeed

Then install nginx.

  1. 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.

  1. 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

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.