zoukankan      html  css  js  c++  java
  • nginx 一键安装

    #!/bin/bash

    #This was create by steven

    #creat time 2017/04/06

    #定义nginx软件安装所需要的软件包函数

    nginx_dependency_install(){

    echo "Wait a moment it need some time to install these software"

    /usr/bin/yum install pcre pcre-devel openssl openssl-devel gcc gcc+ make -y &>/tmp/nginx_yum.log #通过yum安装依赖软件包

    if [ $? -eq 0 ];then

    echo "Nginx dependency package install succeed"

    else

    echo "Nginx dependency package install failed"

    exit

    fi

    }

    #定义安装路径变量

    variable(){

    v="1.10.2" #nginx version

    p="/application/nginx-$v" #nginx install directory

    }

    #定义安装nginx的路径以及创建nginx用户

    create_directory(){

    variable

    useradd nginx -s /sbin/nologin -M >>/tmp/nginx_yum.log#add service account

    mkdir -p "$p" #create directory

    cd /software/

    tar xf nginx-$v.tar.gz

    cd /software/nginx-$v&&

    if [ $? -eq 0 ];then

    echo "create directory succeed"

    else

    echo "create direcotry false"

    fi

    }

    #编译安装nginx

    make_install(){

    echo "This install need about one minuts"

    variable

    cd /software/nginx-"$v"

    if [ $? -eq 0 ];then

    ./configure --user=nginx --group=nginx --prefix=/application/nginx-"$v"/ --with-http_stub_status_module --with-http_ssl_module &>>/tmp/nginx_install.log

    fi

    if [ $? -eq 0 ];then

    /usr/bin/make &>>/tmp/nginx_install.log

    fi

    if [ $? -eq 0 ];then

    /usr/bin/make install &>>/tmp/nginx_install.log

    fi

    if [ $? -eq 0 ];then

    echo "Nginx install succeed"

    else

    echo "Nginx install faild"

    exit 1

    fi

    }

    #定义测试nginx是否启动的变量

    Testing(){

    variable

    $p/sbin/nginx

    if [ $? -eq 0 ];then

    echo "nginx start succeed"

    else

    echo "nginx start failed"

    exit 0

    fi

    }

    #执行上面所定义的变量

    nginx_dependency_install

    create_directory

    make_install

    Testing

  • 相关阅读:
    Node(十一)mongoose配合Node实现注册登录(注册上传头像,登录成功后显示用户信息)
    JS案例:购物车操作(简单实现)
    JS案例:Jq中的fadeOut和fadeIn实现简单轮播(没完善,简单实现)
    JS案例:小球拖动,记录轨迹,并原路返回
    html框架frame iframe
    单元测试
    软件测试计划、依据、规范
    软件测试
    html表单
    html块 布局
  • 原文地址:https://www.cnblogs.com/dianzixiaoming/p/6692589.html
Copyright © 2011-2022 走看看