I wanted to have a quick play with Googles Pagespeed module, as I use NGINX and not Apache I needed to compile NGINX from source to enable the ngx_pagespeed module. The following assumes you are have a clean CentOS 7 installation.

First off you need to install the packages which enable you to compile NGINX with ngx_pagespeed from source.

NGINX & ngx_pagespeed on CentOS 7 1/8
yuminstall-ygcc-c++pcre-devpcre-develzlib-develmakeunzipopenssl-devel

Now create a NGINX user and make so the user doesn’t have a shell.

NGINX & ngx_pagespeed on CentOS 7 2/8
uusseerramdoddn-gsin/xsbin/nologinnginx

Once the required packages have been installed and have created the NGINX user it’s time to grab a copy of the ngx_pagespeed and psol source code. See https://github.com/pagespeed/ngx_pagespeed/releases for latest release details.

NGINX & ngx_pagespeed on CentOS 7 3/8
cNwucwtdPgndgaSezer/_tintuVpg-sEhxhxrRtr_tz/SteptvlIplapfoOsegscN:ae:$a=/ss/{l1ep/N/.g-edPs9i$elSr.t{d._c3hN-gV/2uProE.bSeoR3._lgScVelIoEaeOmRs.N/Sec}pI-o.aO$mtgN{/ae}Ndrs-Pl.pbSgee_pzetVadaEg/.RenzS-giIsxpOp_Nep}ea-dgb/eepstspaele/d$/{aNrPcSh_iVvEeR/SrIeOlNe}a.stea-r$.{gNzPS_VERSION}-beta.zip

Now grab the latest version of NGINX. See http://nginx.org/en/download.html for details on the latest release.

NGINX & ngx_pagespeed on CentOS 7 4/8
cNwtcdGgadIer/NtnuX-gs_hxirVtvn/EtzxlRpf-oS:$cI/n{aO/gNlNniG/=gnIs1ixNr.n-Xc7x$_/..{V1oNE0rGRgIS/NIdXOo_NwV}nE/lRoSaIdO/Nn}g.itnaxr-.$g{zNGINX_VERSION}.tar.gz

Now you have the source its time to configure NGIX and compile

NGINX & ngx_pagespeed on CentOS 7 5/8
m/ackoenf&i&gumraekeiandsdt-amloldule=/usr/local/src/ngx_pagespeed-release-${NPS_VERSION}-betawith-http_ssl_modulesbin-path=/usr/sbin/nginxconf-path=/etc/nginx/nginx.conferror-log-path=/var/log/nginx/error.loghttp-log-path=/var/log/nginx/access.log

Now you have NGINX compiled and installed on your server. While you could manage the process manually it’s best to create an init script. As CentOS 7 uses systemd you need to create a service file in /usr/lib/systemd/system/.

NGINX & ngx_pagespeed on CentOS 7 6/8
c[DA[TPEEEP[WNFssaUefSyIxxxrIaGiyytnstepDeeeinnInssicereFcccvstNatttrrv=iSRSateXlee]i=ifltettad_lmmpscoealoelBSycc/tyer=ropTlyEttuis]k/ta=m]=Ryllsolir=d/pmVornonu/=b=uIues/=ggnu/itlCntlT./sbnrtEnaaihtnri/uiebrbeag/nke-elt/ris/iudesngnbklsnygexiiletngsit.nlrogitnp/l-.inexninstenxmedg-anxdHtisQra/TwnUgbsToxHIelyPrUTtesk-Pta.c$aent$Mnmda/MAd/reAInrgtINsgeecNPtivt/PIanenIDrxrrgDt.seisemnteoxhrpt/evrenio-gscxfieeysnr.xvst.ieaccrroeNvgn.GeefIrtNXn_sSsE-RlVoIoCkEup.target

If everything has gone as expected you should have NGINX running your server with the ngx_pagespeed module also loaded. Now you will to do playing with ngx_pagespeed, first of all create a cache directory and make sure that NGINX can read and write to it;

NGINX & ngx_pagespeed on CentOS 7 7/8
mckhdoiwrn-vRarn/gnignxx_:pagveasrp/enegdx__cpaacgheespeed_cache

then add some directives to your NGINX virtual host block. I used to the following for my tests;

NGINX & ngx_pagespeed on CentOS 7 8/8
pplllllll##la}ppaaoooooooodaaggcccccccEacdggeeaaaaaaanna_eesstttttttsdthssppiiiiiiiuieppeeooooooornoaeeeennnnnnneondeeddedd~~/////re~roFnnnppexEUnigggaaqtns;l^xxxggur\aee//___eeea.bECpnpppsssnplxaagaaappteaepcgxgggeesog;Fehe_eeeeeueirespsssddfssliPpappp__optmaegeeecarheeeteeeeeodeernhdsdddnmpadst_p___siad\asesgmonge.clvtetleler(aJaadaose{ss[nsrt_tbspaoM/ibiaa{aeg-ninceslgleezing/at_ealdt]cixcislo\af_oct{lwos.lip{nsaope)iea$taw1tt?zrg}{il2i.[eesl17ma_os{ato2.i-jnpliw70zza;e}lc..e]veos100d{adw2..2s_{701r}cc1..;e\ra2a01s.ic7l.;do[ph.l0eu^te0o.dnr._;.w1eyc]l0;ne{i.1yas1b12dl0r;7ealg}a.nl;o\rd0yl.ie.;}t[en0ao^sy.l}.,1lt]ea;;h+xletld}e;ep{nnad}yg_ecasalpcleh;eed,}ehxatnednlde_rcache_pdfs,combine_css,combine_javascript,move_css_above_scripts,insert_dns_prefetch,rewrite_javascript,rewrite_images,prioritize_critical_css,rewrite_css,rewrite_style_attributes,convert_meta_tags,lazyload_images,collapse_whitespace,move_css_to_head,remove_comments,remove_quotes,inline_css,inline_javascript;