• CentOS6.9 安装OpenResty


    1、安装依赖包

    yum install -y gcc gcc-c++ readline-devel pcre-devel openssl-devel tcl perl

    2、安装OpenResty

    首先安装LuaJIT 

    cd /usr/local/software
    wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz tar zxvf LuaJIT-2.0.5.tar.gz
    cd LuaJIT-2.0.5 make make install export LUAJIT_LIB
    =/usr/local/lib export LUAJIT_INC=/usr/local/include/luajit-2.0

    安装OpenResty 

    wget --no-check-certificate https://openresty.org/download/openresty-1.13.6.2.tar.gz
    tar -xzvf openresty-1.13.6.2.tar.gz
    cd openresty-1.13.6.2/
    ./configure --with-luajit gmake gmake install

    lua相关模块就已经安装完成,利用下面命令查看

    /usr/local/openresty/nginx/sbin/nginx -V

    设置Nginx为服务和开机启动 

    vi /etc/rc.d/init.d/nginx
    复制代码
    #!/bin/bash
    # Tengine Startup script# processname: nginx
    # chkconfig: - 85 15
    # description: nginx is a World Wide Web server. It is used to serve
    # pidfile: /var/run/nginx.pid
    # config: /usr/local/nginx/conf/nginx.conf
    nginxd=/usr/local/openresty/nginx/sbin/nginx
    nginx_config=/usr/local/openresty/nginx/conf/nginx.conf
    nginx_pid=/usr/local/openresty/nginx/logs/nginx.pid
    RETVAL=0
    prog="nginx"
    # Source function library.
    . /etc/rc.d/init.d/functions
    # Source networking configuration.
    . /etc/sysconfig/network
    # Check that networking is up.
    [ ${NETWORKING} = "no" ] && exit 0
    [ -x $nginxd ] || exit 0
    # Start nginx daemons functions.
    start() {
    if [ -e $nginx_pid ];then
    echo "tengine already running...."
    exit 1
    fi
    echo -n $"Starting $prog: "
    daemon $nginxd -c ${nginx_config}
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
    return $RETVAL
    }
    # Stop nginx daemons functions.
    stop() {
    echo -n $"Stopping $prog: "
    killproc $nginxd
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
    }
    reload() {
    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${nginx_pid}`
    killproc $nginxd -HUP
    RETVAL=$?
    echo
    }
    # See how we were called.
    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    reload)
    reload
    ;;
    restart)
    stop
    start
    ;;
    
    status)
    status $prog
    RETVAL=$?
    ;;
    *)
    echo $"Usage: $prog {start|stop|restart|reload|status|help}"
    exit 1
    esac
    exit $RETVAL
    复制代码

     保存退出

    chmod 775 /etc/rc.d/init.d/nginx   #赋予文件执行权限
    chkconfig  --level 012345 nginx on   #设置开机启动
    service nginx start
  • 相关阅读:
    JDBCj简介
    HttpStatus各种状态
    centos7安装docker并安装jdk和tomcat(常用命令)
    使用递归算法结合数据库解析成java树形结构
    大型网站系统架构的演化
    虚拟机下克隆3个centos系统并配置IP访问网络(转载)
    docker安装方法(常见安装出错问题汇总)
    Vmware虚拟机三种网络模式详解
    谈谈渲染,玩玩nginx——前后端分离,转发请求到Tomcat的尝试
    nginx实现wap移动端和PC端业务分离
  • 原文地址:https://www.cnblogs.com/littlehb/p/3645348.html
Copyright © 2020-2023  润新知