-
Image optimization: stripping metadata, dynamic adjustment, and recompression -
CSS and JavaScript compression, merging, cascading, inline -
Small resource inline -
Postpone image and JavaScript loading -
Rewrite HTML, compress spaces, remove comments, etc -
Increase cache cycle
sudo yum install gcc-c++ pcre-devel zlib-devel make unzip
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip
Download various software
Download ngx_pagespeed
cd /usr/local/src wget https://github.com/pagespeed/ngx_pagespeed/archive/latest-stable.tar.gz tar -xvzf latest-stable.tar.gz mv ngx_pagespeed-latest-stable ngx_pagespeed cd ngx_pagespeed wget https://dl.google.com/dl/page-speed/psol/1.11.33.4.tar.gz tar -xzvf 1.11.33.4.tar.gz && rm -rf 1.11.33.4.tar.gz ./scripts/pagespeed_libraries_generator.sh > /usr/local/nginx/conf/pagespeed_libraries.conf
Download nginx
cd /usr/local/src wget http://nginx.org/download/nginx-1.10.2.tar.gz tar -xvzf nginx-1.10.2.tar.gz && rm -rf nginx-1.10.2.tar.gz
Download OpenSSL
cd /usr/local/src wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz tar -xzvf openssl-1.0.2-latest.tar.gz && rm -rf openssl-1.0.2-latest.tar.gz
ls openssl-1.0.2j
Download PCRE
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz tar -xzvf pcre-8.39.tar.gz && rm -rf pcre-8.39.tar.gz
Install ngx_pagespeed
Get arguments
nginx -V
--prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../ openssl-1.0.2j --with-pcre=../ pcre-8.39 --with-pcre-jit --with-ld-opt=-ljemalloc
Reorganize required software
/usr/local/src/openssl-1.0.2j
/usr/local/src/pcre-8.39
/usr/local/src/ngx_pagespeed
Organize new arguments
--prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=/usr/local/src/openssl-1.0.2j --with-pcre=/usr/local/src/pcre-8.39 --with-pcre-jit --with-ld-o pt=-ljemalloc --add-module=/usr/local/src/ngx_pagespeed
Start Installation
cd /usr/local/src/nginx-1.10.2 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=/usr/local/src/openssl-1.0.2j --with-pcre=/usr/local/src/pcre-8.39 --with-pcre-jit --with-ld-opt=-ljemalloc --add-module=/usr/local/src/ngx_pagespeed make && make install
nginx -V nginx version: nginx/1.10.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) built with OpenSSL 1.0.2j 26 Sep 2016 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=/usr/local/src/openssl-1.0.2j --with-pcre=/usr/local/src/pcre-8.39 --with -pcre-jit --with-ld-opt=-ljemalloc --add-module=/usr/local/src/ngx_pagespeed
nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful