#!/bin/bash
#auto zhangjia
#date 20171007
#安装SSL##############################################################3
SSL(){
URL=https://www.openssl.org/source/openssl-1.1.0f.tar.gz
TARFILE=openssl-1.1.0f.tar.gz
DIR=openssl-1.1.0f
wget -c $URL && tar -xzvf $TARFILE && cd $DIR && ./config
if [ $? -eq 0 ];then
make && make install
echo -e "\033[32mSSL install success...\033[0m"
else
echo -e "\033[32mSSL install failde,please check...\033[0m"
fi
}
#rewrite模块需要pcre库##################################################333333
yum -y install gcc
yum -y install gcc-c++
pcre(){
URL=https://ftp.pcre.org/pub/pcre/pcre-8.38.tar.gz
TARFILE=pcre-8.38.tar.gz
DIR=pcre-8.38
wget -c $URL && tar -xzvf $TARFILE && cd $DIR && ./configure
if [ $? -eq 0 ];then
make && make install
echo -e "\033[32mpcre install success...\033[0m"
else
echo -e "\033[32mpcre install failde,please check...\033[0m"
fi
}
#################安装gzip模块###################
gzip(){
URL=http://www.zlib.net/zlib-1.2.11.tar.gz
TARFILE=zlib-1.2.11.tar.gz
DIR=zlib-1.2.11
wget -c $URL && tar -xzvf $TARFILE && cd $DIR && ./configure
if [ $? -eq 0 ];then
make && make install
echo -e "\033[32mgzip install success...\033[0m"
else
echo -e "\033[32mgzip install failde,please check...\033[0m"
fi
}
#################安装nginx###################
nginx(){
URL=https://nginx.org/download/nginx-1.12.1.tar.gz
TARFILE=nginx-1.12.1.tar.gz
DIR=nginx-1.12.1
wget -c $URL && tar -xzvf $TARFILE && cd $DIR && ./configure --with-pcre=../pcre-8.38/ --with-zlib=../zlib-1.2.11/ --with-openssl=../openssl-1.1.0f/
if [ $? -eq 0 ];then
make && make install
echo -e "\033[32mnginx install success...\033[0m"
else
echo -e "\033[32mnginx install failde,please check...\033[0m"
fi
}
###############开机自动启动########################
nginx_start (){
echo "/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf" >> /etc/rc.local
}
###############select选择##########################33
echo -e "\033[32mPlease select install mnue: \033[0m"
select i in "SSL" "pcre" "gzip" "nginx" "nginx_start"
do
case $i in
SSL)
SSL;;
pcre)
pcre;;
gzip)
gzip;;
nginx)
nginx;;
nginx_start)
nginx_start;;
esac
done