Use PageSpeed with NGINX
Enable PageSpeed
To enable PageSpeed, add the configuration below within the server block of the /opt/bitnami/nginx/conf/nginx.conf file:
pagespeed on;
pagespeed FileCachePath /opt/bitnami/nginx/var/ngx_pagespeed_cache;
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
Restart the NGINX server for your changes to take effect.
$ sudo /opt/bitnami/ctlscript.sh restart nginx
Disable PageSpeed
To disable PageSpeed, follow these steps:
-
Comment out the following lines within the server block of the /opt/bitnami/nginx/conf/bitnami/bitnami.conf file, as shown:
# pagespeed on; # pagespeed FileCachePath /opt/bitnami/nginx/var/ngx_pagespeed_cache;
-
Restart NGINX:
$ sudo /opt/bitnami/ctlscript.sh restart nginx