码迷,mamicode.com
首页 > 其他好文 > 详细

centos一键安装nginx

时间:2017-10-15 14:53:16      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:ssl   path   star   nload   mod   bsp   pcre   inux   start   

#!/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

标签:ssl   path   star   nload   mod   bsp   pcre   inux   start   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!