Created
November 14, 2014 21:37
-
-
Save neophiliac/94d482fae94e36ced487 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
version="1.7.7" | |
pcre_version="8.36" | |
openssl_version="1.0.1j" | |
libressl_version="2.1.1" | |
pagespeed_version="1.9.32.1" | |
set -e | |
if [ ! -w /usr/src ]; then | |
echo "/usr/src is not writable. Exiting." | |
exit | |
fi | |
cd /usr/src | |
rm -rf nginx-$version | |
gitclone_if_not_present() { | |
local dirname="$1" | |
local src="$2" | |
[ -z $dirname ] && { echo "${FUNCNAME}(): file name not specified"; exit 1; } | |
[ -z $src ] && { echo "${FUNCNAME}(): file source not specified"; exit 1; } | |
if [ ! -d $dirname ]; then | |
git clone "$src" "$dirname" | |
fi | |
} | |
# download nginx | |
wget -nc http://nginx.org/download/nginx-$version.tar.gz | |
tar -zxvf nginx-$version.tar.gz | |
# the following modules go in the contrib directory | |
# get pcre | |
wget -nc ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-$pcre_version.tar.gz | |
tar -zxvf pcre-$pcre_version.tar.gz -C nginx-$version/contrib/ | |
## get openssl | |
#wget -nc http://www.openssl.org/source/openssl-$openssl_version.tar.gz | |
#tar -zxvf openssl-$openssl_version.tar.gz -C nginx-$version/contrib/ | |
## get libressl | |
#wget -nc http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-$libressl_version.tar.gz | |
#tar -zxvf libressl-$libressl_version.tar.gz -C nginx-$version/contrib/ | |
# get compression lib | |
gitclone_if_not_present nginx-$version/contrib/zlib git://github.com/madler/zlib.git | |
# clone extensions | |
mkdir -p nginx-$version/ext | |
#gitclone_if_not_present nginx-$version/ext/nginx-upload-module \ | |
# git://github.com/vkholodkov/nginx-upload-module.git | |
gitclone_if_not_present nginx-$version/ext/nginx-upstream-fair \ | |
git://github.com/gnosek/nginx-upstream-fair.git | |
gitclone_if_not_present nginx-$version/ext/nginx_syslog_patch \ | |
https://github.com/yaoweibin/nginx_syslog_patch.git | |
# pagespeed optimization library | |
#cd ngx_pagespeed | |
wget -nc https://github.com/pagespeed/ngx_pagespeed/archive/release-$pagespeed_version-beta.zip | |
unzip release-$pagespeed_version-beta.zip | |
mv ngx_pagespeed-release-$pagespeed_version-beta nginx-$version/ext/ngx_pagespeed | |
wget -nc https://dl.google.com/dl/page-speed/psol/$pagespeed_version.tar.gz | |
tar -xzvf $pagespeed_version.tar.gz | |
mv psol nginx-$version/ext/ngx_pagespeed | |
# configure | |
cd nginx-$version | |
./configure --prefix=/opt/nginx \ | |
--conf-path=/etc/nginx/nginx.conf \ | |
--http-proxy-temp-path=/var/tmp/nginx/proxy \ | |
--lock-path=/var/lock/nginx.lock \ | |
--pid-path=/var/run/nginx.pid \ | |
--without-http_autoindex_module \ | |
--without-http_geo_module \ | |
--without-http_scgi_module \ | |
--without-http_ssi_module \ | |
--without-http_uwsgi_module \ | |
--with-http_gzip_static_module \ | |
--with-http_spdy_module \ | |
--with-http_gzip_static_module \ | |
--with-http_realip_module \ | |
--with-http_stub_status_module \ | |
--with-http_ssl_module \ | |
--add-module=ext/nginx-upstream-fair \ | |
--add-module=ext/ngx_pagespeed \ | |
--user=www-data \ | |
--group=www-data \ | |
--with-debug \ | |
--with-ipv6 \ | |
--with-zlib=/usr/src/nginx-$version/contrib/zlib/ \ | |
--with-pcre=/usr/src/nginx-$version/contrib/pcre-$pcre_version/ \ | |
--with-pcre-jit | |
# --add-module=ext/nginx-upload-module \ | |
# --with-openssl=contrib/libressl-$libressl_version \ | |
# --with-sha1=contrib/libressl-$libressl_version \ | |
# --with-sha1-asm \ | |
# --with-md5=contrib/libressl-$libressl_version \ | |
# --with-md5-asm \ | |
make | |
#make install | |
# cleanup | |
cd .. | |
#rm -rf nginx-$version* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment