Forked from marklkelly/openresty-http2-pagespeed-install.sh
Last active
March 10, 2019 00:22
-
-
Save gnanakeethan/c6d1e613f56338d7a77872b6dd151caf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
clear | |
# Set versions. Check http://openresty.org for latest version and bundled version of nginx. | |
OPENRESTY_VERSION=1.13.6.2 | |
NGINX_VERSION=1.13.6 | |
OPENSSL_VERSION=1.1.1b | |
NPS_VERSION=v1.13.35.2 | |
# Install some pre-requisites | |
apt-get install libpcre3-dev libssl-dev perl make build-essential curl | |
# Get OpenResty | |
cd /usr/local/src/ | |
wget http://openresty.org/download/ngx_openresty-${OPENRESTY_VERSION}.tar.gz | |
tar vxf ngx_openresty-${OPENRESTY_VERSION}.tar.gz | |
# Get OpenSSL | |
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz | |
tar vxf openssl-${OPENSSL_VERSION}.tar.gz | |
# Patch Nginx to provide HTTP/2 support | |
cd /usr/local/src/ngx_openresty-${OPENRESTY_VERSION}/bundle/nginx-${NGINX_VERSION} | |
wget http://nginx.org/patches/http2/patch.http2.txt | |
# Test patch | |
patch -p1 --dry-run < patch.http2.txt | |
# Apply patch | |
patch -p1 < patch.http2.txt | |
# Get pagespeed | |
wget https://github.com/apache/incubator-pagespeed-ngx/archive/${NPS_VERSION}-stable.zip | |
unzip ${NPS_VERSION}-stable.zip | |
cd ngx_pagespeed-${NPS_VERSION}-stable/ | |
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz | |
tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/ | |
# Now we can build OpenResty / Nginx. | |
cd /usr/local/src/ngx_openresty-${OPENRESTY_VERSION} | |
./configure --with-http_ssl_module \ | |
--with-luajit \ | |
--with-openssl=/usr/local/src/openssl-${OPENSSL_VERSION} \ | |
--with-http_v2_module \ | |
--add-module=build/nginx-${NGINX_VERSION}/ngx_pagespeed-release-${NPS_VERSION}-beta | |
make && make install | |
# Check install. | |
/usr/local/openresty/nginx/sbin/nginx -t | |
/usr/local/openresty/nginx/sbin/nginx -V |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment