Skip to content

Instantly share code, notes, and snippets.

@marklkelly
Last active August 30, 2018 07:11
Show Gist options
  • Save marklkelly/a8dba8cecee35ee8d826 to your computer and use it in GitHub Desktop.
Save marklkelly/a8dba8cecee35ee8d826 to your computer and use it in GitHub Desktop.
#!/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
# 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
# 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
make && make install
# Check install.
/usr/local/openresty/nginx/sbin/nginx -t
/usr/local/openresty/nginx/sbin/nginx -V
@Hamada92
Copy link

thanks man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment