zoukankan      html  css  js  c++  java
  • centos自动安装nginx

    #!/bin/bash
    [ -f /etc/init.d/functions ] && . /etc/init.d/functions
    Install_path=/usr/local
    Code_path=/home/usr
    echo "------------------------start install nginx------------------------"
    sleep 3
    for soft in "gcc-c++" "zlib" "zlib-devel" "pcre" "pcre-devel" "openssl" "openssl-devel"
    do
        if [[ ! `rpm -qa $soft|wc -l` -eq 1 ]];then
          yum install $soft -y
        else
          rpm -e $soft -y
          yum install $soft -y
        fi
    done
    if [ ! `grep nginx /etc/passwd|wc -l` -eq 1 ];then
      echo "adding user nginx....."
      useradd nginx -s /sbin/nologin -M
    else
      echo "user nginx exsits"
    fi
    echo "------------environment installation c``ompleted------------"
    sleep 2
    echo "--------------------------download nginx-------------------------"
    sleep 3
      [ -d $Code_path ] && cd $Code_path||mkdir $Code_path && cd $Code_path
        wget http://nginx.org/download/nginx-1.17.1.tar.gz
        tar -xf nginx-1.17.1.tar.gz
        cd nginx-1.17.1
    echo "--------------------download completed-----------------------"
    sleep 2
    echo "-------------------------- install nginx----------------------------"
    sleep 3
      [ -d $Install_path ]||mkdir $Install_path
    ./configure --prefix=$Install_path/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module
      if [ $? -ne 0 ];then
        echo "configure failed ,please check it out!"
        exit 2
      else
        echo "make nginx, please wait......"
        make
      fi
      if [ $? -ne 0 ];then
        echo "make failed ,please check it out!"
        exit 3
      else
        echo "install nginx, please wait......"
        make install
          if [ $? -ne 0 ];then
            echo "make install error,please check it out"
            exit 4
          else
            echo "make install succeed!!!"
          fi
      fi
        chown -R nginx.nginx $Install_path/nginx
        ln -s $Install_path/nginx/sbin/nginx /usr/local/sbin/
        /usr/local/sbin/nginx
    sleep 3
    echo "-----------------nginx install succeed---------------------"
  • 相关阅读:
    fiddler查看IP地址和请求响应时间
    web安全测试排查
    搞站思路 <陆续完善中>
    sys模块进度条玩法笔记
    Webbench、ab命令:做压力测试的工具和性能的监控工具
    xlwings excel(三)
    xlwings excel(二)
    xlwings excel(一)
    xlwings API Documentation
    Python+Excel 操作对比
  • 原文地址:https://www.cnblogs.com/xiaoweiv/p/13723937.html
Copyright © 2011-2022 走看看