Hi,
Do I need to do the below steps for Google PageSpeed module from Google’s instructions or is it duplication of this https://rtcamp.com/tutorials/nginx/using-pagespeed/. I ended up doing both, and it’s performing faster, but I’m wondering now if I installed stuff I did not need or duplicated efforts, and if this would hurt me later.
I followed Google’s instructions for page speed here: https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
Build ngx_pagespeed From Source
To install our dependencies, run:
Ubuntu or Debian
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip
Then download ngx_pagespeed:
cd
NPS_VERSION=1.9.32.3
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip
unzip release-${NPS_VERSION}-beta.zip
cd ngx_pagespeed-release-${NPS_VERSION}-beta/
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/
Module Configuration
In Nginx you need to add several lines to your nginx.conf. In every server block where PageSpeed is enabled add:
pagespeed on;
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed FileCachePath /var/ngx_pagespeed_cache;
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }