Question

Unable to change options for ngx_pagespeed

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?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.

@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

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.