#!/bin/bash
#nginx 编译安装
wget https://nginx.org/download/nginx-1.24.0.tar.gz &>/dev/null
if [ $? -eq 0 ];then
echo "下载成功"
else
echo "下载失败,请检查网络"
fi
userdel -r nginx &>/dev/null
useradd -s /sbin/nologin -M nginx
yum -y install gcc gcc-c++ make ncurses ncurses-devel wget openssl* pcre* &>/dev/null
if [ $? -eq 0 ];then
echo "环境准备成功"
else
echo "检查网络"
fi
echo "编译安装中,请耐心等待..."
tar xf nginx-1.24.0.tar.gz &>/dev/null
cd nginx-1.24.0 && ./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 &>/dev/null && make install &>/dev/null
if [ $? -eq 0 ];then
echo "success"
else
echo “安装失败检查源文件”
fi
编译安装nginx
最新推荐文章于 2024-08-09 16:24:01 发布