标签:Stub 系统 http nload config txt load eal user
#!/bin/bash
#作者:星云法师(头条号:西西图图---专注美食领域的研究)
#环境:centos7,如果是其它的系统可以相应做调整。
#--------选择安装方式,网络晚装还是本地安装--------------
read -p "Install nginx from internet or localpacke?answer i or l:" installway
installways=`echo $installway| tr [a-z] [A-Z]`
read -p "Install some need tools(Y/N):" needpack
needpacks=`echo $needpack| tr [a-z] [A-Z]`
#----是否要配置安装环境---------------------------
if [ "$needpacks" == "Y" ];then
cd /etc/yum.repos.d
mkdir -p /etc/yum.repo.bak
mv /etc/yum.repos.d/* /etc/yum.repo.bak
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum -y install openssh-clients wget gcc gcc-c++ install zlib zlib-devel openssl openssl-devel pcre-devel
elif [ "$needpacks" != "Y" ]&&[ "$needpacks" != "N" ];then
echo "Input error!"
exit 1
fi
#-----网络实际安装---------------------
if [ "$installways" == "I" ];then
cd /tmp
curl http://nginx.org/download/|awk -F‘"‘ ‘{print $2}‘|grep "nginx"|grep "tar"|awk -F‘.tar‘ ‘{print $1}‘ >/tmp/nginxtmp.txt
sort /tmp/nginxtmp.txt|uniq
#-------选择安装版本
read -p "which version you want to install(input all you see):" version
wget http://nginx.org/download/$version".tar.gz"
tar xf $version".tar.gz"
if [ $? -eq 0 ];then
cd $version/
groupadd nginx
useradd nginx -g nginx -s /sbin/nologin -M
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module
if [ $? -eq 0 ];then
make && make install
if [ $? -eq 0 ];then
echo "the bin in /usr/local/nginx/sbin/"
fi
fi
fi
#------本地安装--------------------
elif [ "$installways" == "L" ];then
#-----安装包来源主机---------------
read -p "which ip your nginx packge from:" fromip
#-----安装包在远程主机的路径---------------
read -p "which path your packge in:" path
#-----安装包版本,要全称--------------------
read -p "which version your packge is(all name:nginx-1.14.2):" lversion
if [ "$fromip" != "" ]&&[ "$path" != "" ];then
destpath=$fromip:$path$lversion
scp root@$destpath /usr/local
cd /usr/local
tar xf $lversion".tar.gz"
if [ $? -eq 0 ];then
cd $lversion/
groupadd nginx
useradd nginx -g nginx -s /sbin/nologin -M
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module
if [ $? -eq 0 ];then
make && make install
if [ $? -eq 0 ];then
echo "the bin in /usr/local/nginx/sbin/"
fi
fi
fi
fi
elif [ "$installways" != "I" ]&&[ "$installways" != "L" ];then
echo "Input error!";exit 1
fi
标签:Stub 系统 http nload config txt load eal user
原文地址:https://www.cnblogs.com/xingyunfashi/p/11818623.html