首页 > 其他 > 详细

centos一键安装nginx

时间:2017-10-15 12:10:00      阅读:240      评论:0      收藏:0      [点我收藏+]

#!/bin/bash
select banben in nginx-1.6.3 nginx-1.7.3 nginx-1.8.1 nginx-1.9.9
do
if [[ -n $banben ]] ;then
break
fi
done
path_nginx="http://nginx.org/download/$banben.tar.gz"
nname=`echo $path_nginx | awk -F/ ‘{print $NF}‘`
prefix="/home/$banben"
rpm_list[0]="pcre"
rpm_list[1]="openssl"
rpm_list[2]="openssl-devel"
rpm_list[3]="gcc"
rpm_list[4]="wget"
rpm_list[5]="pcre-devel"
rpm_list[6]="lsof"
for((i=0;i<${#rpm_list[*]};i++)){
rpmq=`rpm -qa ${rpm_list[$i]}`
if [[ -z $rpmq ]];then
echo "${rpm_list[$i]} ..........is not found"
echo "Start install ${rpm_list[$i]} "
yum -y install ${rpm_list[$i]}
else
echo "${rpm_list[i]} is OK !"
fi
}
temp=`mktemp -d`
cd $temp
wget $path_nginx
if [[ -e $nname ]];then
tar -xvzf $nname
cd nginx*
useradd nginx -s /sbin/nologin -M
./configure --user=nginx --group=nginx --prefix=$prefix --with-http_stub_status_module --with-http_ssl_module
make
make install
ln -s $banben /home/nginx
/home/nginx/sbin/nginx -t
cd /etc/init.d/
wget 45.34.66.172/linux/nginx/nginx.sh && mv nginx.sh nginx && chmod 777 nginx && sed -i ‘s/\r$//‘ nginx
service nginx start
echo "+++++++++++++++++++++++++++++++++++++++"
echo "+ Nginx is start now +"
echo "+++++++++++++++++++++++++++++++++++++++"
lsof -i :80
else
echo "$nname is not found"
fi

 

centos一键安装nginx

原文:http://www.cnblogs.com/uyahs/p/7670404.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!