FeaturesWP CloudPricingEE CLIContactMy Account
Features
Team Access & User Permissions
Install
Resources
Community
CLEAR
Tutorials
Nginx
Using Pagespeed
Topics
On this page
-
- Getting Started
- Git and File-System Layout (non-default setup)
- Version Constraints
- Managing Themes and Plugins (for entire WordPress site)
- Updating Themes and Plugins (for entire WordPress site)
- Adding Composer Support to Your Own Themes and Plugins (for developers)
- Using Composer to Manage Own Theme/Plugin Dependencies (for developers)
-
- Assigning Multiple IP Addresses to Single LAN Card
- Disable IPv6 on Ubuntu 12.04
- dsh – distributed shell
- fdupes – find & replace duplicate files with hardlinks
- GPG Keys Cheatsheet
- Increase "Open Files Limit"
- kill all php, nginx, mysql or any kind of processes
- Passwordless Authentication for SSH
- Screen
- search replace in multiple files useing grep xargs sed
- Setup sftp
- sysctl.conf
- Timezone Sync
- Using Google Public DNS on Ubuntu Server
- Using openssl to match private key, cerificate and CSR
- Configure Postfix to Use Gmail SMTP on Ubuntu
- Logrotate Example for Custom Logs
- PHP 5.5, MySQL, Postfix, Nginx and WordPress on Ubuntu
- Serverdensity
- Upgrade Ubuntu 10.04 to 12.04
- Using find and sed to replace strings in multiple files
- Webmin
-
- .my.cnf – mysql user & password
- Analyse slow-query-log using Anemometer
- Improving MySQL Query Cache
- MySQL Query Profiling
- Reset MySQL root password
- tuning-primer.sh – an alternative for mysqltuner
- Using MariaDB 10
- Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS
- Change WordPress Domain Name
- Character Sets and Collations
- Enable innodb_file_per_table
- Enable Remote Access (Grant)
- Installing Percona Toolkit
- Using tmpfs for temporary folder creation
- YARPP and InnoDB
- Convert MyISAM to InnoDB
- Using tmpfs for mysqldump & mysqlimport
- Convert from INNODB to MYISAM
- Analyse slow-query-log using mysqldumpslow & pt-query-digest
- mysqlcheck with cron to optimize automatically
- Using MySQLTuner to Optimize MySQL configuration
-
-
- Directly connect to PHP-FPM
- Generating core-dump for php5-fpm
- GeoIP
- Having php5 and php7 on same system.
- Install Xdebug and configure it with webgrind
- Installation of PHP Code Review Tools
- memcache
- PHP's Zend Opcache Config & Web Viewer
- Setting Sqlite support with PHP
- Using HHVM with PHP-FPM Fallback
- Using Redis for PHP Sessions on Ubuntu Server
- Installing PhpMyAdmin Quickly
- Moving PHP's session storage to tmpfs
- Install Xdebug and configure it with Netbeans
- Nginx – Enable PHP-FPM Status Page
- PHP-FPM: Socket vs TCP/IP and sysctl tweaking
- APC Cache Optimization & Monitoring Using Web Interface
- Checking if PHP/WordPress can send mails
- Debugging PHP Scripts Using slow_log and more
- Increase file upload size limit in PHP-Nginx
- Increase PHP script execution time with Nginx
-
- Performance Optimization
- Remove Query string of css/js files
- Setup ElasticSearch with ElasticPress
- Using Redis for WordPress Object-Cache
- WooCommerce Window Shopping Caching Technique
- Moving WordPress To New Server (Faster)
- Better wp-cron using linux's crontab
- 404 error- Page not Found!!!
- Debugging WordPress with Nginx
Adding Nginx repo
Installation of Nginx Pagespeed
Creating Pagespeed global configuration
Creating site specific Pagespeed configuration
Enable Pagespeed for site
Enable/Disable PageSpeed Filters
Test your site
View Pagespeed statistics
Disable Pagespeed temporary
Purge Pagespeed Cache
Using Pagespeed
Note: This feature is depreciated with EasyEngine v3.6.0.
Note: Test your site properly before using this in production.
Adding Nginx repo
If you are EasyEngine user then you can skip this step
For Ubuntu 12.04/14.04:
add-apt-repository -y ppa:rtcamp/nginx
apt-get update
For Debian 6/7:
echo "deb http://packages.dotdeb.org $(lsb_release -sc) all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -sc).list
apt-get update
Installation of Nginx Pagespeed
For Ubuntu 12.04/14.04:
apt-get install nginx-custom
Note: If you are using EasyEngine then this step is not required
For Debian 6/7:
apt-get install nginx-extras
This will install nginx-extras on your server, by removing nginx-full.
Creating Pagespeed global configuration
Create new pagespeed global configuration file
vim /etc/nginx/conf.d/pagespeed.conf
and paste following code into it
# Turning the module on and off
pagespeed on;
# Configuring PageSpeed Filters
pagespeed RewriteLevel PassThrough;
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed MemcachedServers "127.0.0.1:11211";
pagespeed FileCachePath /var/ngx_pagespeed_cache;
# PageSpeed Admin
pagespeed StatisticsPath /ngx_pagespeed_statistics;
pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics;
pagespeed MessagesPath /ngx_pagespeed_message;
pagespeed ConsolePath /pagespeed_console;
pagespeed AdminPath /pagespeed_admin;
pagespeed GlobalAdminPath /pagespeed_global_admin;
# PageSpeed Cache Purge
pagespeed EnableCachePurge on;
pagespeed PurgeMethod PURGE;
Creating site specific Pagespeed configuration
Create new site specific configuration file
vim /etc/nginx/common/pagespeed.conf
Paste following code into it
# PageSpeed Admin
location /ngx_pagespeed_statistics { include common/acl.conf; }
location /ngx_pagespeed_global_statistics { include common/acl.conf; }
location /ngx_pagespeed_message { include common/acl.conf; }
location /pagespeed_console { include common/acl.conf; }
location ~ ^/pagespeed_admin { include common/acl.conf; }
location ~ ^/pagespeed_global_admin { include common/acl.conf; }
# 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$" { }
Enable Pagespeed for site
Open site Nginx configuration:
vim /etc/nginx/sites-available/example.com
add following line at in the configurations:
include common/pagespeed.conf;
and restart Nginx
nginx -t && service nginx restart
Enable/Disable PageSpeed Filters
Please paste following filter inside /etc/nginx/sites-available/example.com
# HTTPS Support
# pagespeed FetchHttps enable;
# PageSpeed Filters
# CSS Minification
# pagespeed EnableFilters combine_css,rewrite_css;
# JS Minification
# pagespeed EnableFilters combine_javascript,rewrite_javascript;
# Images Optimization
#pagespeed EnableFilters lazyload_images;
#pagespeed EnableFilters rewrite_images;
#pagespeed EnableFilters convert_jpeg_to_progressive,convert_png_to_jpeg,convert_jpeg_to_webp,convert_to_webp_lossless;
# Remove comments from HTML
#pagespeed EnableFilters remove_comments;
# Remove WHITESPACE from HTML
#pagespeed EnableFilters collapse_whitespace;
# CDN Support
#pagespeed MapRewriteDomain cdn.example.com www.example.com;
By default we commented all filters. You can uncomment filters that you need for your site.
Also you can add various filters from here to this file: https://developers.google.com/speed/pagespeed/module/filters
Test your site
You can test site by pointing browser to example.com, and seeing its html code.
View Pagespeed statistics
You can view Pagespeed statics by poinitng your browser to http://example.com/ngx_pagespeed_statistics
Disable Pagespeed temporary
You can disable pagespeed temporary by using this url: http://example.com/?PageSpeed=off
Purge Pagespeed Cache
You can purge specific file cache by hitting following url http://exmple.com/pagespeed_admin/cache?purge=/path/file.ext
Using $upstream_cache_status in access.log
PREVIOUS
Weak Diffie Hellman Logjam Attack Fix
NEXT
Features
- Server Setup & Management
- Site Creation & Management
- Create WP Cloud Sites
- Speed & Caching
- Firewall Protection
- Backups & Recovery
- Logs & Monitoring
- Deployments & Developer Tools
- Team Access & User Permissions
Useful Links
Product
Other Products
Subscribe for curated product updates, tips, and announcements.
"*" indicates required fields
This field is for validation purposes and should be left unchanged.
Email*
SIGN ME UP
Δ
© rtCamp, since 2009. All rights reserved.