Google技術之 mod_Pagespeed 網頁優化探索(1)
關於網路的優化,蒐集資料後發現Google在n年前推出modpagespeed這個模組(估計你打不開 哈哈,所以我會把原文介紹拿下來一起學習一下)。首先我來介紹一下小玩意的內容
mod_pagespeed releases 1.9.32.2-beta and 1.8.31.5-stable are available as precompiled linux packages or as source. (See Release Notes for information about bugs fixed)
mod_pagespeed is an open-source Apache module which automatically applies web performance best practices to pages, and associated assets (CSS, JavaScript, images) without requiring that you modify your
existing content or workflow.
mod_pagespeed is built on PageSpeed Optimization Libraries, deployed across 100,000+ web-sites, and provided by popular hosting and CDN providers such as DreamHost, GoDaddy, EdgeCast, and others. There are 40+ available optimizations filters, which include:
- Image optimization, compression, and resizing
- CSS & JavaScript concatenation, minification, and inlining
- Cache extension, domain sharding, and domain rewriting
- Deferred loading of JavaScript and image resources
這個玩意是基於PageSpeed Optimization Libraries(psol,開源喲。)開發的,目前這個東東已經被超過10w+的網站運用了,當然他也被很多CDN廠商應用,比較有名的又dreamHost,狗爹 .....他有超過40項以上的優化策略,其中包括
專案相關連結: 簡介: 考慮google被和諧的比較嚴重,所以把主要的流程拷貝如下(當然我也嘗試了一下,果然好用。)
- RedHat, CentOS, or Fedora//安裝依賴
-
sudo yum install gcc-c++ pcre-dev pcre-devel zlib-devel make unzip
- Ubuntu or Debian
-
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip
Then download ngx_pagespeed://下載對應模組,psol模組下載的是lib庫喲。
cd NPS_VERSION=1.9.32.2 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/
Download and build nginx with support for pagespeed://下載nginx 並安裝mod_pagespeed模組。
cd # check http://nginx.org/en/download.html for the latest version NGINX_VERSION=1.6.2 wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz tar -xvzf nginx-${NGINX_VERSION}.tar.gz cd nginx-${NGINX_VERSION}/./configure --add-module=$HOME/ngx_pagespeed-release-${NPS_VERSION}-beta make sudo make install如何測試療效?? 搭建 一臺nginx做代理伺服器,這臺伺服器上安裝mod_pagespeed。走起!!!! 1、配置nginx.conf 路徑:/usr/local/nginx/conf/nginx.conf 2、/usr/local/nginx/sbin/nginx 命令執行。 3、獲取網路內容
對比沒有通過代理服務的內容比較兩點內容變化: