Skip to content

Instantly share code, notes, and snippets.

@marklkelly
Last active December 1, 2021 16:09

Revisions

  1. marklkelly renamed this gist Nov 9, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions gistfile1.txt → openresty-http2-pagespeed-install.sh
    Original file line number Diff line number Diff line change
    @@ -6,10 +6,10 @@ clear
    OPENRESTY_VERSION=1.9.3.1
    NGINX_VERSION=1.9.3
    OPENSSL_VERSION=1.0.2d
    NPS_VERSION=1.8.31.4
    NPS_VERSION=1.9.32.10

    # Install some pre-requisites
    yum install -y readline-devel pcre-devel gcc zlib-devel patch
    yum install -y readline-devel pcre perl pcre-devel gcc zlib-devel patch unzip gcc-c++ make

    # Get OpenResty
    cd /usr/local/src/
    @@ -42,8 +42,8 @@ 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=ngx_pagespeed-${NPS_VERSION}-beta
    --with-http_v2_module \
    --add-module=build/nginx-${NGINX_VERSION}/ngx_pagespeed-release-${NPS_VERSION}-beta

    make && make install

  2. marklkelly created this gist Nov 9, 2015.
    52 changes: 52 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    #!/bin/bash
    set -o errexit
    clear

    # Set versions. Check http://openresty.org for latest version and bundled version of nginx.
    OPENRESTY_VERSION=1.9.3.1
    NGINX_VERSION=1.9.3
    OPENSSL_VERSION=1.0.2d
    NPS_VERSION=1.8.31.4

    # Install some pre-requisites
    yum install -y readline-devel pcre-devel gcc zlib-devel patch

    # 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/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/

    # 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=ngx_pagespeed-${NPS_VERSION}-beta

    make && make install

    # Check install.
    /usr/local/openresty/nginx/sbin/nginx -t
    /usr/local/openresty/nginx/sbin/nginx -V