#!/bin/bash function install_nginx() { ########################################### readonly install_path=/usr/local/ ########################################### [ $? -ne 0 ] && yum install wget -y if [ $# -lt 2 ] then version=1.14.2 else version=$2 fi readonly gzip_file_name="nginx-${version}.tar.gz" readonly file_name="nginx-${version}" readonly workdir="./$file_name" ################################################# readonly install_directory=${install_path}/nginx-${version} ########################################### mkdir -p $workdir cd $workdir [ $? -ne 0 ] && echo -e "\033[31m\033[01mChange Directory Error: No Such File Or Path\033[0m" && exit which wget &> /dev/null [ $? -ne 0 ] && yum install wget -y echo -en "install nginx-${version}." sleep 1 echo -en "." sleep 1 echo -en "." sleep 2 && echo download_url="http://nginx.org/download/nginx-${version}.tar.gz" [ ! -f $gzip_file_name ] && wget $download_url -O $gzip_file_name ################### install packages ################# yum install gcc-c++ make pcre-devel openssl-devel libxml2-devel libxslt-devel -y ################### configure ######################## readonly backup_date=$(date +%Y-%m-%d_%H-%M-%S) [ -d $file_name ] && mv $file_name ${file_name}_$backup_date tar xf $gzip_file_name cd $file_name ./configure \ --prefix=${install_directory} \ --without-select_module \ --with-debug \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_xslt_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_v2_module \ --with-stream \ --with-stream_ssl_module \ --with-stream_realip_module \ --with-file-aio \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-http_auth_request_module \ --with-pcre make && make install ln -sf ${install_directory}/sbin/nginx /usr/local/sbin/ # /usr/bin/cp contrib/vim/* /usr/share/vim/vimfiles/ -r # 添加 vim 对 nginx 语法高亮的支持 # 使用其他方式语法高亮 cd - echo "install success " echo "install_directory: ${install_directory}" } ############################################ function do_rewrite_nginx_page(){ cd ${install_directory} cat << EOF > html/500.html
Access restrictions
Because you are not in the area of our service, we are unable to provide you with services for the time being, please forgive us!