How to Install ngx_pagespeed with Nginx 1.19.0 with VestaCP/myVesta on Linux

First of all, I would like to thank Mysterydata for their article on this subject. The thing is they did provide a downloadable library ngx_pagespeed.so but this file is compiled for the Nginx 1.18.0 version. And now VestaCP provide another Nginx version and their library is not compatible anymore.

Some of my websites really need Pagespeed, so I found the way to compile it myself. I will also provide the downloadable library here for the last version.

Downloadable ngx_pagespeed (easy method)

Google Pagespeed version Nginx version ngx_pagespeed
1.13.35.1-0 Nginx 1.19.0 ngx_pagespeed-1.19.0

Get the module

Load ngx_pagespeed in Nginx

In /etc/nginx/nginx.conf, add on the first line

Enable ngx_pagespeed on domain vhost

Vhost config files are located on a specific folder with VestaCP :

For each domain, modify both the non-ssl and the ssl config files

Add under server { block add the foloowing  code

Restart Nginx

Check the configs

If the output show OK, proceed with restart

Testing Pagespeed

Test nginx pagespeed is working or not via this Online checker : https://ismodpagespeedworking.com/

Or via cURL

You will see a line like this: X-Page-Speed: 1.13.35.2-0

Compile ngx_pagespeed for any Nginx version

Simply follow the guide from Google itself: https://www.modpagespeed.com/doc/build_ngx_pagespeed_from_source

And add the result of

to the line

Example

On my Nginx with VestCP installation, I use the command sudo nginx -V and I have the output

So I will us the ./configure command below

 

1 commentaire sur “How to Install ngx_pagespeed with Nginx 1.19.0 with VestaCP/myVesta on Linux

  1. Ping :[Update 2021] Guide Ultime d'Installation d'une Boutique b2c/b2b Prestashop 1.7 - Partie 1 - Metrodyn

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *