1. #!/bin/bash
    2. #Nginx 安装脚本
    3. #version v1.20.2
    4. #请使用source命令执行该脚本
    5. #关闭防火墙并查看状态
    6. systemctl stop firewall
    7. setenforce 0
    8. systemctl status firewall
    9. getenforce
    10. sudo yum -y install gcc gcc-c++ make ncurses ncurses-devel pcre pcre-devel openssl openssl-devel zlib zlib-eve
    11. if [ $? -eq 0 ];then
    12. sudo useradd nginx
    13. wget http://nginx.org/download/nginx-1.20.2.tar.gz
    14. if [ $? -eq 0 ];then
    15. tar xf nginx-1.20.2.tar.gz -C /usr/local/
    16. cd /usr/local/nginx-1.20.2
    17. ./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
    18. make -j4 && make -j4 install
    19. else
    20. echo "下载失败,请删除后再次下载"
    21. fi
    22. else
    23. echo "安装依赖包未完成"
    24. fi