#!/bin/bash
nginxdir=nginx-1.16.1
nginx=/usr/local/nginx/sbin/nginx
author(){
echo "----------------------------------------------------------------------------------------------------"
echo "- nginx installed -"
echo "- Author: lxl -"
echo "- micro letter: l15565623507 -"
echo "----------------------------------------------------------------------------------------------------"
}
nginx_install(){
echo "unzip and install nginx nginx dependent on the environment ..."
echo "============================================="
tar -zxf nginx-1.16.1.tar.gz
yum -y install -q gcc gcc-c++ pcre-devel zlib-devel
echo "============================================="
echo "nginx compiled"
echo "---------------------------------------------"
cd /usr/local/src/$nginxdir && ./configure && make && make install
echo "---------------------------------------------"
rm -rf $nginxdir
author
}
ss -ntlp|grep -q nginx
if [ $? -eq 0 ];then
echo "nginx already exists"
else
cd /usr/local/src
if [ ! -e /usr/local/src/nginx-1.16.1 ];then
nginx_install
else
echo "nginx source package download Please wait ......"
wget -q http://nginx.org/download/nginx-1.16.1.tar.gz
echo "the download is complete!"
nginx_install
author
be
be