Speed up your XenForo site

Speed up your XenForo site


Well-known member
So how are you excluding those from defer_javascript? The pagespeed devs acknowledge that pagespeed disallow doesn't do it.
maybe it's a modpagespeed vs ngx_pagespeed specific issue ? if it's a bug then it would of broken xenforo for me at least as i know you can not defer xenforo.js and query min js files without breaking stuff (with ngx_pagespeed at least)

and if it's a bug when disallow xenforo.js allows defer_js filter to work and still defer xenforo.js, then i can live with that too :D Although i suspect it's move css above js filter that's in play

Amin Sabet

Well-known member
yeah maybe.. yeah that's with css and due to bd cache css and it's interaction with ngx_pagespeed

bd cache needs selective css file concatentation support
I had to disable [bd] Cache CSS to file. Too often I'm seeing little issues popping up like this one for example:


Refreshing the page fixes those issues, but it's unsightly.

I've also stopped the approach of deferring javascript globally with exceptions, instead opting to specifically defer selected javascript files.

Those two changes have made my sites significantly slower, but I'd rather have decently fast and very stable sites than blazingly fast, somewhat buggy sites.

Jury still out on [bd] Cache caching pages for guests feature. Not sure if it's worth the overhead.

Amin Sabet

Well-known member
Just a quick note to say that I updated the resource to specify which ones I'm currently using.

Somehow the combination of [bd] Cache and ngx_pagespeed is giving me headaches, ranging from odd bits of unstyled content to members saying they can't login on Firefox. I'm sure there is a way to make it work, but most of my pageviews come from members (caching pages for guests not so important to me), and ngx_pagespeed doesn't seem as necessary now that my sites are http/2. So I've discontinued both [bd] Cache and ngx_pagespeed.

In happier news, I proved to myself that without a doubt, KeyCDN is speeding up my sites. The effect is most noticeable in Australia, but even on the west coast of the US there are gains (my server is on the east coast). I also added a couple minor things to the tips, for example disabling automatic serialization when not needed.


Active member
Wow. I've read the whole thread. This is such a very informative thread. I'll follow along.

It seems that the only way to achieve the suggestions in this thread is to invest in a VPS/Dedicated Server.

Does the Linux distro even matter? I'm quite familiar with Debian/Ubuntu than Centos.


I'm still digging into this. It looks like during the rebuild process, apache downgraded from 2.4.17 (contains the needed code) to 2.4.16. This was announced by cpanel on 10/26 for the edge build, and on 10/27. The current version of easyapache builds the httpd 2.4.16 version. Here was their announcement to the edge users list:

Apache was upgraded to 2.4.17 in EasyApache build 3.32.3, which was released a couple of weeks ago on Oct 15th. After release, we observed issues caused by REDIRECT_URL being changed to server a full URL, rather than a relative URL / file path.

While some applications have started making changes to ensure their applications and plugins work with the changes, we feel that it’s better to revert Apache back to 2.4.16, and then re-release 2.4.17 after upstream fixes are in place. As such, we will be releasing EasyApache 3.32.4 tomorrow, Oct 26 with the aforementioned changes.

We recommend downgrading to Apache 2.4.16 if you are running into problems with REDIRECT_URL and mod_rewrite. Also, while cPanel doesn’t officially support http2 yet, we know some customers have been tinkering with it. If you downgrade Apache back to 2.4.16, this will remove the http2 and associated modules from the Apache stack.

Once Apache releases a fix for the major issues, Apache 2.4.17 will be patched and then released again.

It looks like easyapache is still in the 2.4.16 version, cPanel intends to release 2.4.17 as soon as possible after identifying and correcting the issue. The settings I added should pick up the build at that time as soon as it's available, as set in this file:

# cat /var/cpanel/easy/apache/rawopts/Apache2_4

However, it won't be possible to set that up today..:coffee:
Apache 2.4.18 is now available in EasyApache.
Based on these instructions: https://icing.github.io/mod_h2/howto.html OpenSSL 1.0.2 is required.
As I'm using cPanel I'm not sure whether it is safe to simply update OpenSSL. If you have tried it then please post your results.

Amin Sabet

Well-known member
I've gone back to using Pagespeed, and I'm convinced it helps. Today I took 4 different types of pages at mu-43.com and tested them with (p) or without (-p) ngx_pagespeed enabled using the comparison tool from webpagetest.org, which tests each one 3 times. Visually faster with pagespeed in 4 out of 4 pages:


Amin Sabet

Well-known member
I've started to use @AndyB addons Convert Image and Convert Image All addons to convert hotlinked images to attachments.

My sites are photography forums with up to 10-20MB of images per page, and there was a huge hit on page loading times. Some images at the end of pages were timing out. @MattW has been helping me with this.

Putting all attachments on CDN (KeyCDN) using [Tinhte] Image Attachment Optimization & CDN Support by @Dinh Thanh made a massive difference, and my sites are speedy again.

Amin Sabet

Well-known member
Last edited:


Well-known member
Pagespeed image optimization results can be downright dramatic.
now you know why my forums been using Centmin Mod Nginx + ngx_pagespeed for 2+ yrs now :D

edit: oh and if you enable ngx_pagespeed admin console you have access to alot of ngx_pagespeed cache and image optimisation stats https://community.centminmod.com/threads/admin-stats-console-revamp-in-ngx_pagespeed-1-9-32-1-beta.1669/ :)

item 10 at https://centminmod.com/nginx_ngx_pagespeed.html outlines how to enable and configure Centmin Mod Nginx's ngx_pagespeed admin console :)


Well-known member
One of my members posted this 433kb image: https://www.mu-43.com/data/attachments/116/116278-60dec99cefc2e4ae5c662c565d58af10.jpg

ngx_pagespeed converted that to this 16kb one: https://www.mu-43.com/data/attachme...2c565d58af10.jpg.pagespeed.ic.7dFSOFEzOi.webp

That is a 96% reduction in file size without a change in image size with minimal change in image quality :).
might want to share your experience at https://community.centminmod.com/threads/benefits-of-ngx_pagespeed.1032/ :)