2017-02-04 15:51:49 +00:00
|
|
|
#!/bin/sh -x
|
|
|
|
|
2017-02-10 03:16:46 +00:00
|
|
|
ngxversion=1.10.3
|
|
|
|
ngxsigningkey=B0F4253373F8F6F510D42178520A9993A1C052F8
|
|
|
|
|
2017-02-07 10:49:45 +00:00
|
|
|
LUAJITURL="http://luajit.org/download/LuaJIT-2.0.3.tar.gz"
|
2017-02-04 15:51:49 +00:00
|
|
|
|
|
|
|
MODS="
|
|
|
|
https://github.com/openresty/headers-more-nginx-module.git
|
2017-02-07 11:35:33 +00:00
|
|
|
https://github.com/openresty/lua-nginx-module.git
|
2017-02-07 14:04:07 +00:00
|
|
|
https://github.com/simpl/ngx_devel_kit.git
|
2017-02-04 15:51:49 +00:00
|
|
|
https://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
|
|
|
|
"
|
|
|
|
|
|
|
|
OPTS="
|
|
|
|
--with-http_sub_module
|
|
|
|
--with-http_ssl_module
|
|
|
|
"
|
|
|
|
|
2017-02-07 10:49:45 +00:00
|
|
|
opt_dir=`dirname $0`
|
|
|
|
cd $opt_dir || exit 1
|
|
|
|
opt_dir=`pwd`
|
|
|
|
|
|
|
|
# dependencies
|
|
|
|
|
2017-02-07 11:15:45 +00:00
|
|
|
sudo aptitude install -y libpcre3-dev zlib1g-dev libssl-dev || exit 1
|
2017-02-07 10:49:45 +00:00
|
|
|
|
|
|
|
# get NGINX and cd into it
|
|
|
|
|
2017-02-10 03:16:46 +00:00
|
|
|
ngxurl=http://nginx.org/download/nginx-$ngxversion.tar.gz
|
|
|
|
sigurl=http://nginx.org/download/nginx-$ngxversion.tar.gz.asc
|
|
|
|
file=`basename "$ngxurl"`
|
|
|
|
sig=`basename "$sigurl"`
|
2017-02-07 10:49:45 +00:00
|
|
|
dir=`basename "$file" .tar.gz`
|
2017-02-10 03:16:46 +00:00
|
|
|
test -f "$file" || curl -o "$file" "$ngxurl" || exit 1
|
|
|
|
test -f $sig || curl -o $sig $sigurl || exit 1
|
|
|
|
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys $ngxsigningkey || exit 1
|
|
|
|
gpg --verify $sig || exit 1
|
2017-02-07 10:49:45 +00:00
|
|
|
test -d "$dir" || tar zxf "$file" || exit 1
|
|
|
|
|
|
|
|
cd $dir || exit 1
|
|
|
|
src_dir=`pwd`
|
|
|
|
|
|
|
|
# make luajiturl
|
|
|
|
|
2017-02-10 03:16:46 +00:00
|
|
|
luaurl=$LUAJITURL
|
|
|
|
file=`basename "$luaurl"`
|
2017-02-07 10:49:45 +00:00
|
|
|
dir=`basename "$file" .tar.gz`
|
2017-02-10 03:16:46 +00:00
|
|
|
test -f "$file" || curl -o "$file" "$luaurl" || exit 1
|
2017-02-07 10:49:45 +00:00
|
|
|
test -d "$dir" || tar zxf "$file" || exit 1
|
|
|
|
|
|
|
|
(
|
|
|
|
cd $dir || exit 1
|
|
|
|
make DESTDIR=$opt_dir install
|
|
|
|
)
|
|
|
|
|
|
|
|
# get mods
|
|
|
|
|
2017-02-04 15:51:49 +00:00
|
|
|
MODADD=""
|
|
|
|
|
|
|
|
for modurl in $MODS ; do
|
|
|
|
moddir=`basename $modurl .git`
|
2017-02-07 10:49:45 +00:00
|
|
|
if [ -d $moddir ] ; then
|
|
|
|
( cd $moddir ; exec git pull ) || exit 1
|
|
|
|
else
|
|
|
|
git clone $modurl || exit 1
|
|
|
|
fi
|
|
|
|
MODADD="$MODADD --add-module=$src_dir/$moddir"
|
2017-02-04 15:51:49 +00:00
|
|
|
done
|
|
|
|
|
2017-02-07 10:49:45 +00:00
|
|
|
# make NGINX
|
|
|
|
|
|
|
|
export LUAJIT_LIB=$opt_dir/usr/local/lib
|
|
|
|
export LUAJIT_INC=$opt_dir/usr/local/include/luajit-2.0
|
|
|
|
|
|
|
|
env \
|
|
|
|
./configure \
|
|
|
|
--with-ld-opt="-Wl,-rpath,$LUAJIT_LIB" \
|
|
|
|
--prefix=$opt_dir \
|
|
|
|
$OPTS \
|
|
|
|
$MODADD || exit 1
|
|
|
|
|
2017-02-04 16:28:16 +00:00
|
|
|
make || exit 1
|
2017-02-07 10:49:45 +00:00
|
|
|
|
2017-02-04 16:28:16 +00:00
|
|
|
make install || exit 1
|
2017-02-04 15:51:49 +00:00
|
|
|
|
2017-02-07 10:49:45 +00:00
|
|
|
cd $opt_dir || exit 1
|
|
|
|
|
2017-02-04 16:36:17 +00:00
|
|
|
ln -s sbin/nginx || exit 1
|
|
|
|
|
2017-02-04 16:28:16 +00:00
|
|
|
exit 0
|