⚡脚本
#!/bin/bash
#
#********************************************
#Author: jacklee
#QQ:
#Time:
#FileName: nginx.sh
#Copyright: 2020 All rights reserved
#Description:
#*********************************************
ins() {
yum -y install gcc pcre-devel openssl-devel zlib-devel
useradd -s /sbin/nologin nginx
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar xf nginx-1.18.0.tar.gz
cd nginx-1.18.0/
./configure \
--prefix=/apps/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module || { echo -e "\e[1;32m<./configure执行失败>\e[0m"; exit; }
make && make install && echo -e "\e[1;32m<nginx编译安装成功>\e[0m"
chown -R nginx.nginx /apps/nginx
ln -s /apps/nginx/sbin/nginx /usr/sbin/
nginx && ss -ntl | grep -q 80 && echo -e "\e[1;32m<nginx启动成功>\e[0m"
exit
}
[ -e /apps/nginx/sbin/nginx ] || ins
=