#!/bin/bash #2020年2月16日 #auto_install_nginx_web.v3 #by fly ################################ #NGX_VER="$1" NGX_CNF="nginx.conf" NGX_YUM="yum install -y" NGX_DIR="/usr/local/nginx" NGX_SOFT="nginx-${NGX_VER}.tar.gz" NGX_URL="http://nginx.org/download" NGX_SRC="$(echo ${NGX_SOFT}|sed 's/.tar.*//g')" NGX_ARGS="--user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module" #安装nginx function nginx_install(){ $NGX_YUM gcc-c++ pcre pcre-devel zlib zlib-devel $NGX_YUM wget make openssl openssl-devel net-tools cd /usr/src read -p "请选择版本号:(1.12.0|1.14.0|1.15.0|1.16.0):" NGX_VER NGX_SOFT="nginx-${NGX_VER}.tar.gz" NGX_SRC="$(echo ${NGX_SOFT}|sed 's/.tar.*//g')" wget -c $NGX_URL/$NGX_SOFT tar -xf $NGX_SOFT cd $NGX_SRC useradd nginx ./configure --prefix=$NGX_DIR $NGX_ARGS make && make install $NGX_DIR/sbin/nginx ps -ef|grep nginx netstat -nutlp|grep -w 80 #setenforce 0 sed -i '/SELIUNX/s/enforcing/disabled/g' /etc/selinux/config systemctl stop firewalld.service echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local echo -e "