Unable to change options for ngx_pagespeed

  • Posted October 7, 2019
  • 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:

Any tips?


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

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.

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:

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:

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


which pagespeed

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

Let me know how it goes.