자동화 설치 Nginx - 1.6.2
#!/bin/bash
# ADD Module
# 1: nginx-upstream-fair
#
Install_dir="/usr/local/nginx"
Download_dir="/home/tools"
Nginx_Major_Version="1.6"
Nginx_Minor_Version="2"
Nginx_Configure="./configure \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_gunzip_module \
--add-module=../nginx-upstream-fair"
check_result(){
if [ $1 != 0 ];then
echo -e "\e[1,44m <==== Error,Exit install nginx ====> \e[0m"
exit 1
fi
}
install_or_not(){
read -p "Install nginx, Input Y ; Do not install nginx,Input N:" INSTALL_OR_NOT
case $INSTALL_OR_NOT in
Y|y)
install
;;
N|n)
echo -e "\e[0;44m <====Stop install Nginx====> \e[0m"
exit 1
;;
*)
echo -e "\e[1;44m Only Input Y or N \e[0m"
install_or_not
;;
esac
}
root_or_not(){
if [ `id -u` != 0 ] ; then
echo -e "\e[1;44m <====You are not root,Please login in root!====> \e[0m"
exit 1
fi
}
install_develop_tools(){
yum install gcc gcc-c++ pcre pcre-devel openssl openssl-devel wget unzip man -y
check_result $?
}
download_nginx(){
[ ! -d ${Download_dir} ] && mkdir ${Download_dir}
wget http://mirrors.sohu.com/nginx/nginx-${Nginx_Major_Version}.${Nginx_Minor_Version}.tar.gz -P ${Download_dir}
check_result $?
cd ${Download_dir} && tar xf nginx-${Nginx_Major_Version}.${Nginx_Minor_Version}.tar.gz
check_result $?
wget https://github.com/gnosek/nginx-upstream-fair/archive/master.zip -P ${Download_dir}
check_result $?
cd ${Download_dir} && mv master.zip nginx-upstream-fair.zip && unzip nginx-upstream-fair.zip && mv nginx-upstream-fair-master nginx-upstream-fair
check_result $?
}
configure_install_nginx(){
if [ ! -d ${Download_dir}/nginx-${Nginx_Major_Version}.{Nginx_Minor_Version} ] && [ ! -d ${Download_dir}/nginx-upstream-fair ] ;then
echo -e "\e[1;44m <=====Some sofeware is not exist=====> \e[0m"
exit 1
else
echo -e "\e[1;44m <=====Start confiugre nginx,make nginx, make install nginx=====> \e[0m"
fi
cd ${Download_dir}/nginx-${Nginx_Major_Version}.${Nginx_Minor_Version}
${Nginx_Configure}
check_result $?
make
check_result $?
make install
check_result $?
}
install(){
echo -e "\e[0;44m <====Startting install Nginx====> \e[0m"
root_or_not
install_develop_tools
download_nginx
configure_install_nginx
}
install_or_not
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
ubuntu DNS로 인해 apt-get install이 잘못되었습니다.fixing temporary resolve messages fixing the package management issues Temporary resolve temporary due to your Internet ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.