nginx_pgspd_build.sh

#!/bin/bash

# Minimal bash script taken from
# https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
# and slightly modified.

# Tested on CentOS 6.6

# set the current working directory (it'll be the starting point)
CWD=`cwd`
# check http://nginx.org/en/download.html for the latest version
NGINX_VERSION=1.7.7
NPS_VERSION=1.9.32.2

# install the needed compilers, libraries and utilities
sudo yum install gcc-c++ pcre-dev pcre-devel zlib-devel make unzip -y

# make a pagespeed folder, change to it and download the specified version
mkdir $CWD/nginx_pagespeed
cd $CWD/nginx_pagespeed
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip

# decompress it and enter dir
unzip release-${NPS_VERSION}-beta.zip
cd ngx_pagespeed-release-${NPS_VERSION}-beta/

# download and decompress psol
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/

# go back to the base build dir
cd $CWD/nginx_pagespeed

# Download and decompress nginx sourcecode
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar -xvzf nginx-${NGINX_VERSION}.tar.gz

# enter dir and build it with the pagespeed module, will install to /opt/nginx/$NGINX_VERSION
cd nginx-${NGINX_VERSION}/
./configure --add-module=$HOME/ngx_pagespeed-release-${NPS_VERSION}-beta --prefix=/opt/nginx/$NGINX_VERSION --with-http_ssl_module
make
sudo make install
(Comments)

Comments