#!/bin/bash
#Nginx 安装脚本
#version v1.20.2
#请使用source命令执行该脚本
#关闭防火墙并查看状态
systemctl stop firewall
setenforce 0
systemctl status firewall
getenforce
sudo yum -y install gcc gcc-c++ make ncurses ncurses-devel pcre pcre-devel openssl openssl-devel zlib zlib-eve
if [ $? -eq 0 ];then
sudo useradd nginx
wget http://nginx.org/download/nginx-1.20.2.tar.gz
if [ $? -eq 0 ];then
tar xf nginx-1.20.2.tar.gz -C /usr/local/
cd /usr/local/nginx-1.20.2
./configure --prefix=/usr/local/nginx --group=nginx --user=nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/tmp/nginx/client_body --http-proxy-temp-path=/tmp/nginx/proxy --http-fastcgi-temp-path=/tmp/nginx/fastcgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre --with-http_realip_module --with-stream
make -j4 && make -j4 install
else
echo "下载失败,请删除后再次下载"
fi
else
echo "安装依赖包未完成"
fi