- 首页 > it技术 > >
#!/bin/bash
#nginx auto-deploy script by xiaojie2018-02-08
path=/usr/local/src
vers=1.14.0
user=nginxyum install gcc gcc-c++ automake zlipzlib-develpcre pcre-devel openssl wget openssl-devel -y
if [ $? -ne 0 ];
then
echo "yum failed"
else
id $user&>/dev/null
[ $? -eq 0 ] && : || useradd$user-s /sbin/nologin -M
[ -d $path ] && : || mkdir -p $path
cd $path
[ -f nginx-${vers}.tar.gz ] && : ||wget http://nginx.org/download/nginx-${vers}.tar.gz
if [ $? -ne 0 ];
then
echo "download nginx false" && exit 1
else
tar xf nginx-$vers.tar.gz
cd $path/nginx-$vers
./configure--prefix=/usr/local/nginx-$vers--user=$user --group=$user --with-http_stub_status_module--with-http_ssl_module --with-http_gzip_static_module--with-http_sub_module --with-pcre
make && makeinstall
[ $? -eq 0 ] && echo "nginx install success" || echo "nginxinstall make error"
ln -sf/usr/local/nginx-$vers/usr/local/nginx
fi
fi
mkdir -p /usr/local/nginx/conf/extra
推荐阅读