nginx 安装

发布时间 2023-12-26 19:25:25作者: EJW
#!/bin/bash
##############################################################
# File Name: install_nginx.sh
# Version: V1.0
# Author: junwang
# Organization: 
# Created Time : 2021-04-13 17:12:54
# Description:
##############################################################
tools_path=/server/tools
install_path=/web
yum install -y gcc gcc-c++ make libxml2 libxml2 libxslt libxml2-dev libxslt-devel gd-devel GeoIP GeoIP-devel GeoIP-data pcre-devel  openssl-devel wget
useradd www -s /sbin/nologin/ -M
mkdir	$tools_path  -p
mkdir	$install_path  -p
cd $tools_path
wget http://nginx.org/download/nginx-1.24.0.tar.gz
if [ $? -ne 0  ]
then
    echo Nginx download failed
    exit 1
fi
tar xf nginx-1.24.0.tar.gz && cd nginx-1.24.0/
./configure --prefix=/web/nginx-24 --user=www --group=www --with-http_ssl_module --with-http_stub_status_module  --with-stream --with-http_gzip_static_module --with-stream_ssl_module
make && make install 
if [ $? -eq 0  ]
then
    echo -e "Nginx installed successfully \n
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@##############################################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@#====*@@@@@@@@@@*===#@@@@@*============#@@@@@@@===#@@@*==*@@@@@@@@@@#===*#@#===*#@@@@@@@@@#*===#@@@@@@
@@@@@@@@@=++++++*@@@@@@@#++++*@@@@=++++======++++=@@@@@#+++=@@*++++@@@@@@@@*++++++=@#++++++*#@@@#*=+++++#@@@@@@
@@@@@@@@@=++++++++*#@@@@#++++*@@#++++*@@@@@@@@#=++=#@@@#+++*@@*++++@@@@@#=++++++++=@@@#=+++++=*=+++++=#@@@@@@@@
@@@@@@@@@=+++=@#=+++=#@@#++++*@=+++=#@@@########****#@@@*###@@*++++@@@#=+++=#@=+++=@@@@@@#=++++++++*@@@@@@@@@@@
@@@@@@@@@=+++=@@@#=+++=##++++*@*++++#@@=++++++++++++#@@#+++*@@*++++##=+++=#@@@=+++=@@@@@@*=++++++++*#@@@@@@@@@@
@@@@@@@@@=+++=@@@@@#=++++++++*@@#=+++*@@@#@@@#=+++=@@@@#+++*@@*++++++++*#@@@@@=+++=@@@*=+++++=*=+++++=*@@@@@@@@
@@@@@@@@@=+++=@@@@@@@#*++++++*@@@@*++++======++++#@@@@@#+++*@@*++++++*@@@@@@@@=+++=@#+++++=*@@@@@*=+++++#@@@@@@
@@@@@@@@@#*=*#@@@@@@@@@@**==*@@@@@@#***======***@@@@@@@@*=*#@@@****#@@@@@@@@@@#***#@@*==*#@@@@@@@@@#*==*#@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
"
else
    echo "Nginx installation failed"
   exit 1
fi
#ln -s $install_path/nginx-12.2 $install_path/nginx
/web/nginx-24/nginx/sbin/nginx
ps -ef|grep nginx
cd $tools_path  && rm -rf *