#!/bin/bash
# nginx update scripts
# url http://www.wdlinux.cn
# author wdlinux
cd /tmp

wget -c http://dl.wdlinux.cn:5180/soft/pcre-8.10.tar.gz

tar zxvf pcre-8.10.tar.gz

cd pcre-8.10

./configure --prefix=/usr

make

make install

cd ..




if [ ! $1 ];then
	ver="1.2.2"
else
	ver=$1
fi
cd /tmp
wget -c http://nginx.org/download/nginx-$ver.tar.gz
[ $? != 0 ] && echo "down err" && exit
tar zxvf nginx-$ver.tar.gz
cd nginx-$ver
./configure --user=www --group=www --prefix=/www/wdlinux/nginx-$ver --with-http_stub_status_module --with-http_sub_module --with-http_ssl_module
[ $? != 0 ] && echo "configure err" && exit
make
[ $? != 0 ] && echo "make err" && exit
make install
[ $? != 0 ] && echo "make install err" && exit
mv /www/wdlinux/nginx-$ver/conf/nginx.conf /www/wdlinux/nginx-$ver/conf/nginx.conf.default
cp -pR /www/wdlinux/nginx/conf/* /www/wdlinux/nginx-$ver/conf/
service nginxd stop
rm -f /www/wdlinux/nginx
ln -sf /www/wdlinux/nginx-$ver /www/wdlinux/nginx
service nginxd start
echo
echo "Nginx Update Is OK"
echo "Current Ver Is:$ver"
echo
