一键源码安装ngxin
Posted l999999999
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一键源码安装ngxin相关的知识,希望对你有一定的参考价值。
#!/bin/bash
nginxdir=nginx-1.16.1
nginx=/usr/local/nginx/sbin/nginx
author(){
echo "----------------------------------------------------------------------------------------------------"
echo "- nginx安装完毕 -"
echo "- 作者:lxl -"
echo "- 微信:l15565623507 -"
echo "----------------------------------------------------------------------------------------------------"
}
nginx_install(){
echo "解压nginx并安装nginx依赖环境中..."
echo "============================================="
tar -zxf nginx-1.16.1.tar.gz
yum -y install -q gcc gcc-c++ pcre-devel zlib-devel
echo "============================================="
echo "nginx编译"
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已经存在"
else
cd /usr/local/src
if [ ! -e /usr/local/src/nginx-1.16.1 ];then
nginx_install
else
echo "nginx源码包下载中,请稍后......"
wget -q http://nginx.org/download/nginx-1.16.1.tar.gz
echo "下载完毕!"
nginx_install
author
fi
fi
以上是关于一键源码安装ngxin的主要内容,如果未能解决你的问题,请参考以下文章