Skip to content

Instantly share code, notes, and snippets.

@intchloe
Created May 8, 2016 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save intchloe/f50c833d3eaf635e70d70c759fff07a1 to your computer and use it in GitHub Desktop.
Save intchloe/f50c833d3eaf635e70d70c759fff07a1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
mkdir -p /root/nginx
cd /root/nginx
apt-get -y install curl wget build-essential libgd-dev libgeoip-dev checkinstall git
export NGINX_VERSION=1.9.9
export VERSION_PCRE=pcre-8.38
export VERSION_LIBRESSL=libressl-2.3.4
export VERSION_NGINX=nginx-$NGINX_VERSION
export SOURCE_LIBRESSL=http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
export SOURCE_NGINX=http://nginx.org/download/
wget -P ./build $SOURCE_PCRE$VERSION_PCRE.tar.gz
wget -P ./build $SOURCE_LIBRESSL$VERSION_LIBRESSL.tar.gz
wget -P ./build $SOURCE_NGINX$VERSION_NGINX.tar.gz
cd build
git clone https://github.com/openresty/headers-more-nginx-module.git
tar xzf $VERSION_NGINX.tar.gz
tar xzf $VERSION_LIBRESSL.tar.gz
tar xzf $VERSION_PCRE.tar.gz
cd ../
export BPATH=$(pwd)/build
export STATICLIBSSL=$BPATH/$VERSION_LIBRESSL
cd $STATICLIBSSL
./configure LDFLAGS=-lrt --prefix=${STATICLIBSSL}/.openssl/ && make install-strip
cd $BPATH/$VERSION_NGINX
mkdir -p $BPATH/nginx
./configure --with-openssl=$STATICLIBSSL \
--with-cc-opt="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2" \
--with-ld-opt="-lrt" \
--add-module=/root/nginx/build/headers-more-nginx-module \
--prefix=/etc/nginx \
--conf-path=/etc/nginx/conf \
--with-pcre=$BPATH/$VERSION_PCRE \
--with-http_ssl_module \
--with-http_v2_module \
--with-file-aio \
--with-ipv6 \
--with-http_gzip_static_module \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-pcre-jit \
--with-http_addition_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
touch $STATICLIBSSL/.openssl/include/openssl/ssl.h
make && checkinstall --pkgname="nginx-libressl" --pkgversion="$NGINX_VERSION" \
--provides="nginx" --requires="libc6, libpcre3, zlib1g" --strip=yes \
--stripso=yes --backup=yes -y --install=yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment