mod_pagespeed is an open-source Apache & Nginx Web Server module created by Google to help Make the Web Faster by rewriting web pages to reduce latency and bandwidth. It has several filters that automatically optimize files like HTML, CSS, JavaScript, JPEG, PNG and other resources to speedup your website 30-40% compare with earlier stage. It support around 45 famous & most useful PageSpeed filters wihch will used to optimize your apache performance such a different aspect & parameter. The latest version of Pagespeed 1.9.32.13 released on March 30, 2016 with Security update, Still pagespeed team working hard to improve the performance. Also you can read about apache mod_pagespeed configuration.
1) Download & Install mod_pagespeed with Nginx on RHEL/CentOS/Fedora
Before proceeding mod_pagespeed
installation, make sure you should uninstall Nginx
web server, if you have on your system. Add Ulyaoth repository and install ulyaoth-nginx-pagespeed
package, which will install Nginx & mod_pagespeed too. Also configure setting automatically and we don’t want to add anything manually.
[Download & Install Nginx with mod_pagespeed]
# yum --enablerepo=ulyaoth install ulyaoth-nginx-pagespeed
See below, Configuration added automatically to Nginx.conf
.
# nano /etc/nginx/nginx.conf
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
pagespeed On;
pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
Start Nginx Web Server.
[Start Nginx on SysVinit systems] $ sudo service nginx start [Start Nginx on systemd systems] $ sudo systemctl start nginx.service
2) Verify pagespeed is running with Nginx
Use the below command to check in terminal whether mod pagespeed working with Nginx or not.
# curl -I localhost
HTTP/1.1 200 OK
Server: nginx/1.8.1
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
Date: Tue, 12 Apr 2016 14:04:45 GMT
X-Page-Speed: 1.11.33.0-0
Cache-Control: max-age=0, no-cache
3) Enable/Disable the module
By default pagespeed module is enabled on Nginx after installation. If you want to disable, you can do by editing the nginx.conf
file.
# nano /etc/nginx/nginx.conf [Enable pagespeed] ModPagespeed on [Disable pagespeed] ModPagespeed off
Keep smile..because your website is now 50-70% speed compare with earlier…cool)
not ModPagespeed, just pagespeed, learn not to copy paste while making tutorials