Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Nginx and Google Pagespeed under Ubuntu

2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to install Nginx and Google Pagespeed under Ubuntu". In daily operation, I believe many people have doubts about how to install Nginx and Google Pagespeed under Ubuntu. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to install Nginx and Google Pagespeed under Ubuntu". Next, please follow the editor to study!

Nginx (engine-x) is an open source high-performance HTTP server, reverse proxy and IMAP/POP3 proxy server. The outstanding features of nginx are: stability, rich feature set, simple configuration and low resource consumption. Nginx is used on some high-performance websites and is becoming more and more popular among webmasters. This tutorial will build a nginx .deb installation package with google paespeed module for Ubuntu 15.04 from the source code.

Pagespeed is a web server module developed by google to speed up site response time, optimize html, and reduce page load time. The functions of ngx_pagespeed are as follows:

Image optimization: removal of metadata, dynamic scaling, recompression.

CSS and JavaScript compression, series, inline, outreach.

Inline of small resources

Image and JavaScript delay loading

HTML rewriting

Cache lifecycle plug-in

Pre-requirement

Ubuntu Server 15.04 64-bit

Root permission

In this article we are going to:

Install prerequisite software packages

Install nginx with ngx_pagespeed

test

Install prerequisites

The code is as follows:

Sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev

Install nginx with ngx_pagespeed

Step 1-add a nginx repository

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 the warehouse:

The code is as follows:

Sudo apt-get update

Note: if you see the message: GPG error [...] NO_PUBKEY [...] Wait

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 2-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 3-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 4-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 CFLAGS .configure in two places:

-- add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta\

Adding pagespeed to nginx

Adding pagespeed to nginx

Step 5-package the nginx package and install it

The code is as follows:

Cd ~ / new/nginx_source/nginx-1.8.0/

Dpkg-buildpackage-b

Dpkg-buildpackage compiles ~ / new/ngix_source/ to nginx.deb. When the package is complete, take a look at the catalog:

The code is as follows:

Cd ~ / new/ngix_source/

Ls

Nginx builded with pagespeed

Then install nginx.

The code is as follows:

Dpkg-I nginx_1.8.0-1~trusty_amd64.deb

test

Run nginx-V to test whether nginx already comes with ngx_pagespeed.

The code is as follows:

Nginx-V

Summary

Stable, fast, open source nginx supports many different optimization modules. One of these is pagespeed' developed by google. Unlike apache,nginx modules, they are not dynamically loaded, so you must select the desired module before compiling it.

At this point, the study on "how to install Nginx and Google Pagespeed under Ubuntu" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 230

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report