Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tjm's avatar
Level 3

Adding ngx_pagespeed module?

Pagespeed is a great apache and nginx module to optimize how a server delivers the page and assets to the browser. However, I've struggled with getting it installed and configured... has anyone been able to do this?

0 likes
9 replies
tjm's avatar
Level 3

Seeing as how this is in the Forge discussion channel, Nginx :) I've been able to get it working on Apache, which seems easier to get it set up on, just not on Nginx.

fideloper's avatar

Looks like this PPA has pagespeed compiled: https://launchpad.net/~adegtyarev/+archive/ubuntu/nginx-pagespeed?field.series_filter=trusty

It's not too far behind Nginx/Stable: https://launchpad.net/~nginx/+archive/ubuntu/stable

So using that first one would be something like

sudo apt-add-repository --remove ppa:nginx/stable
sudo apt-add-repository ppa:adegtyarev/nginx-pagespeed
sudo apt-get update
sudo apt-get install nginx

You may need to uninstall Nginx and then re-install it, I haven't tested switching repositories like that.

tjm's avatar
Level 3

@fideloper thanks for the response. Is the something you can recommend Forge including in the future? Most of the tutorials I walked through I performed on test Forge provisioned servers. I would run into weird 500 errors and no sites would work, and worried about losing the other nice things Forge does for me (Queues, easily adding ssh keys, etc.)

christopher's avatar

https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source

If you`re using ubuntu:

https://launchpad.net/~adegtyarev/+archive/ubuntu/nginx-pagespeed

or:

here`s also a good description:

https://www.digitalocean.com/community/questions/how-to-add-pagespeed-on-existent-nginx-ubuntu-server

and to your question: yes, pagespeed is really easy to setup. And you can add the filter to each nginx vhost. All filters are explained on the pagespeed site.

If you`re on a live site i would make a snapshot of your server and test all thing on another server. Are you using forge+digitalocean ? Do u use ubuntu or debian ?

tjm's avatar
Level 3

@hostianer Thanks for the links. Yes, I am using Forge + DO. I am trying to come up with a way to rebuild nginx with ngx_pagespeed support, but maintain the ability to keep all the awesomeness Forge gives me.

fideloper's avatar

I don't think that will affect Forge, as installing Nginx probably (I can't guarantee this) won't delete the existing Nginx configuration files that Forge needs (settings in /etc/nginx/nginx.conf, /etc/nginx/sites-available/*, the added /etc/nginx/fastcgi_params file).

I'd make a new server just, add a fake site, and just test that out to see what happens. Will probably only cost you < $1 in DO charges to see :D

bashy's avatar

Doubt you can use apt-get if you install the module?

Please or to participate in this conversation.