Unable to change options for ngx_pagespeed

October 7, 2019 78 views
Nginx

I was able to successfully add ngx_pagespeed to my Nginx server. It works - for example I can see it is automatically converting my .jpg images to .webp.

However, I’m not able to edit any options. When I try to run something like pagespeed rewrite_images on, or even pagespeed on, I get an error pagespeed: command not found.

Per documentation pagespeed should be the command for Nginx: https://modpagespeed.com/doc/configuration

Any tips?

3 Answers

Hello, @geochanto

What happens when you call the command with the full path? You can first check where is the binary file by using:

whereis pagespeed

or

which pagespeed

and then call the pagespeed with the full path, it should be in /usr/bin/pagespeed

Let me know how it goes.

@ageorgiev I’m not getting the expected result.

For whereis pagespeed: pagespeed:

For which pagespeed, : no response at all

What should I do? I know it does work because if I run curl -I -p http://localhost| grep X-Page-Speed, I get the expected header in the response: X-Page-Speed: 1.13.35.2-0

It is worth mentioning that digitalocean’s tutorial did not work for me. There were errors when I was running sudo dpkg-buildpackage -b, it was failing on signing the buildfile.

Instead I did an automated install per this: https://www.modpagespeed.com/doc/build_ngx_pagespeed_from_source

by Anatoliy Dimitrov
ngx_pagespeed, or just pagespeed, is an Nginx module designed to optimize your site automatically by reducing the size of its resources and hence the time the clients' browsers need to load it. This article will guide you through the installation and configuration of the pagespeed module for Nginx.

Problem was that for some reason I thought pagespeed flags were turned on/off via terminal commands.

It actually needs to be done as Nginx directives, added to nginx.conf file and restart the Nginx server afterwards. Everything works.

Have another answer? Share your knowledge.