Content Index
How to change the PageSpeed configuration?
CentOS:
Ubuntu:
Enable / Disable Google Pagespeed
Add a parameter to the HTTP Header of the website
Rewrite Level
Add module to Google Pagespeed
List of Google module titles and Pagespeed meaning
Epilogue
Continue reading the series
This article is part 5 of 5 of the series Speeding up with Google Pagespeed
In your Google Pagespeed installation tutorials, if you have followed then it has worked well with some major functions. But in fact, Google Pagespeed has a lot of different functions (called Module) in this article I will explain in detail the meaning of each module and how to enable / disable modules in Google Pagespeed settings.
How to change the PageSpeed configuration?
All of the configurations that we refer to this article will be saved in the pagespeed.conf file, specifically:
CentOS:
For Apache, the settings in the lesson must be added to the pagespeed.conf file, but within the <IfModule pagespeed_module> tags ... </ IfModule>
If you do not have NGINX, then go to the pagespeed.conf file, wherever you are.
Ubuntu:
If you use Ubuntu, follow the instructions below and edit the /etc/nginx/common/pagespeed.conf file. The only setting for turning on Google Pagespeed on Ubuntu will be at /etc/nginx/conf.d/pagespeed.conf.
And after changing the contents of the configuration files, you have to restart Apache or NGINX.
Enable / Disable Google Pagespeed
If you want to turn off the Google Pagespeed feature, just set the value of the following parameter to off instead of on.
Apache:
# On
ModPagespeed on
# Turn off
ModPagespeed off
NGINX:
# On
pagespeed on;
# Turn off
pagespeed off;
Add a parameter to the HTTP Header of the website
If you want to add a parameter to the site when using Google Pagespeed for convenient testing can be easily added by the following:
Apache:
ModPagespeedXHeaderValue "Powered By mod_pagespeed"
NGINX:
pagespeed XHeaderValue "Powered By ngx_pagespeed";
Result:
Cache-Control: max-age = 0, no-cache
Connection: close
Content-Length: 7215
Content-Type: text / html; charset = UTF-8
Date: Wed, 14 Mar 2015 13:00:50 GMT
Server: Apache / 2.2.15 (CentOS)
Vary: Accept-Encoding
X-Mod-Pagespeed: Powered By mod_pagespeed
X-Pingback: https: //thachpham.com/xmlrpc.php
X-Powered-By: PHP / 5.4.38
Rewrite Level
Setting the Google Pagespeed Rewrite Level means configuring the cache type of the data to be compressed. This is because there are a number of modules (or Filters), which only work with certain Rewrite Levels.
Google Pagespeed currently supports three types of Rewrite Levels:
PassThrough: Turn off Rewrite Level.
CoreFilters (default): You should use this to limit errors.
OptimizeForBandwidth: The type of rewrite to save bandwidth for the website
To change the Rewrite Level, you can edit / insert this paragraph:
Apache:
ModPagespeedRewriteLevel PassThrough
NGINX:
pagespeed RewriteLevel PassThrough;
Add module to Google Pagespeed
Adding modules to Google Pagespeed is easy, just add a line to the module and the name of the module needs to be turned on. You can declare modules for use on one or more lines. Like this:
Apache:
# Declare one line
ModPagespeedEnableFilters module_1, module_2, ... module_n
# Declare multiple lines
ModPagespeedEnableFilters module_1, module_2, ... module_n
ModPagespeedEnableFilters module_3, module_4, ... module_n
NGINX:
# Declare one line
pagespeed EnableFilters module_1, module_2, ..., module_n;
# Declare multiple lines
pagespeed EnableFilters module_1, module_2, ..., module_n;
pagespeed EnableFilters module_3, module_4, ..., module_n;
Why use multi-line declarations? You can easily divide, for example, by adding optimized image modules, adding CSS / Javascript optimization modules, stream optimization protocols, and more.
List of Google module titles and Pagespeed meaning
The list of modules of Google Pagespeed a lot so here we will list the most commonly used modules, the most easy for you to reference. Also, you should refer to the list of modules in Google Pagespeed here.
add_head
CoreFilters: Yes
OptimizeForBandwidth: No
Add the <head> tag to your website if you do not already have one.
combine_heads
CoreFilters: No
OptimizeForBandwidth: No
Include if the website has multiple <head> tags found in the document.
inline_import_to_link
CoreFilters: Yes
OptimizeForBandwidth: No
Manually create a CSS file and insert the <link> tag if the website contains a <style> tag and use @import.
outline_css
CoreFilters: No
OptimizeForBandwidth: No
Include CSS inserts directly into the <style> tag in a CSS style sheet and insert the <link> tag.
outline_javascript
CoreFilters: No
OptimizeForBandwidth: No
Include javascript snippets inserted directly into the website at the <script> tag into a buffer JS and insert into the <tag>link
move_css_above_scripts
CoreFilters: No
OptimizeForBandwidth: No
Automatically put all the CSS of the website on the Javascript, in other words, to force the site to load CSS before loading the Javascript.
combine_css
CoreFilters: Yes
OptimizeForBandwidth: No
Compressing multiple CSS files into a common CSS file reduces the number of requests in the website.
rewrite_css
CoreFilters: Yes
OptimizeForBandwidth: Yes
Rewrite CSS - This rewrite optimizes CSS by removing comments, deleting white space, caching CSS files, and so on.
rewrite_style_attributes
CoreFilters: No
OptimizeForBandwidth: No
Enables the rewrite of CSS within a tag that is declared using the style = "..." parameter.
flatten_css_imports
CoreFilters: Yes
OptimizeForBandwidth: No
Split the contents of a CSS file inserted by the @import tag into the <style> tag.
prioritize_critical_css
CoreFilters: No
OptimizeForBandwidth: No
Automatically separates important CSS elements from the website and put it on top of the website so that it loads first.
make_google_analytics_async
CoreFilters: No
OptimizeForBandwidth: No
Automatically converts Google Analytics tracking snippet for async asynchronous loading. That is only loading after the website has finished loading CSS.
rewrite_javascript
CoreFilters: Yes
OptimizeForBandwidth: Yes
Rewrite Javascript - the rewrite will help compress the .js file again by leaving comments, leaving white space.
rewrite_javascript_external
CoreFilters: Yes
OptimizeForBandwidth: Yes
Allows rewriting CSS files outside of the server.
rewrite_javascript_inline
CoreFilters: Yes
OptimizeForBandwidth: Yes
Allows you to rewrite CSS embedded in the style of the website, ie inserted into the <script> tag.
combine_javascript
CoreFilters: Yes
OptimizeForBandwidth: No
Include multiple .js files into a single .js file to reduce load time.
canonicalize_javascript_libraries
CoreFilters: No
OptimizeForBandwidth: No
Automatically use libraries on Google's CDN if available. For example, if your website is using a self-hosted jquery.js file, it will automatically switch to the jquery.js file on Google's CDN.
inline_css
CoreFilters: Yes
OptimizeForBandwidth: No
Move the contents of the CSS file out of the document and insert it into the <style> tag in the website.
inline_google_font_css
CoreFilters: No
OptimizeForBandwidth: No
Automatically convert Google Font inserts tags into website into fixed .woff font format.
inline_javascript
CoreFilters: Yes
OptimizeForBandwidth: No
Manually convert javascript content into .js files and insert them directly into the document using the <script> tag.
local_storage_cache
CoreFilters: No
OptimizeForBandwidth: No
Saving the content of the website as a buffer is carried out at the next visit.
insert_ga
CoreFilters: No
OptimizeForBandwidth: No
Add the Google Analytics embed code to each page of your website.
rewrite_images
CoreFilters: Yes
OptimizeForBandwidth: Yes
Optimize the formation by rewriting the path, compressing the image to webp format, reduce the image size and add time cache for the image.
convert_jpeg_to_progressive
CoreFilters: Yes
OptimizeForBandwidth: Yes
Automatically convert all JPEG images to compressed format.
convert_png_to_jpeg
CoreFilters: Yes
OptimizeForBandwidth: Yes
Convert all PNG images to JPEG.
convert_jpeg_to_webp
CoreFilters: Yes
OptimizeForBandwidth: Yes
Convert all images from JPEG to Webp format.
insert_image_dimensions
CoreFilters: Yes
OptimizeForBandwidth: Yes
Add the width and height parameters to the <img> tag.
inline_images
CoreFilters: Yes
OptimizeForBandwidth: Yes
Convert small images to base64 format.
convert_gif_to_png
CoreFilters: Yes
OptimizeForBandwidth: Yes
Convert GIF images to PNG.
resize_images
CoreFilters: Yes
OptimizeForBandwidth: No
Resize an image.
resize_mobile_images
CoreFilters: No
OptimizeForBandwidth: No
Resize image, but only valid when accessed with mobile browsers.
remove_comments
CoreFilters: No
OptimizeForBandwidth: No
Deletes comments in the HTML source of the website.
collapse_whitespace
CoreFilters: No
OptimizeForBandwidth: No
Remove the whitespace within the HTML source of the website.
sprite_images
CoreFilters: No
OptimizeForBandwidth: No
Automatically trims background images and assemble them into HTML source code using CSS to reduce load time by rotating each piece of the cropped image, this technique is called Sprite Image.
defer_javascript
CoreFilters: No
OptimizeForBandwidth: No
Setting up a website only loads Javascript after the components of the website have finished loading.
lazyload_images
CoreFilters: No
OptimizeForBandwidth: No
Add LazyLoad effect to the entire image in the website (technique only load images when dragging the website scroll down to the component contains images).
Epilogue
Looking through the modules in Google Pagespeed, which is good for the site, but using too many modules will help your server will need more RAM to process, hard drive (save its cache files so choose the modules that you want
Wednesday, May 2, 2018
MEANING OF MODULES IN GOOGLE PAGESPEED AND ON / OFF
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment