CentOS6 下安装openresty

安装过程

  • 安装依赖库

    1
    yum install -y readline-devel pcre-devel openssl-devel gcc postgresql-devel
  • 下载
    https://openresty.org/cn/download.html下载一个发行版

  • 解压安装到/opt/openresty下

    1
    2
    3
    4
    5
    6
    7
    8
    9
    tar xzvf ngx_openresty-VERSION.tar.gz
    cd ngx_openresty-VERSION/
    ./configure --prefix=/opt/openresty \
    --with-luajit \
    --without-http_redis2_module \
    --with-http_iconv_module \
    --with-http_postgres_module
    make -j8
    make install
  • 添加环境变量

    1
    2
    3
    4
    5
    6
    7
    8
    9
    cat >> ~/.bashrc <<EOF
    ######## openresty #########
    export OPENRESTY_HOME=/opt/openresty
    export PATH=\$PATH:\$OPENRESTY_HOME/bin
    export NGINX_HOME=\$OPENRESTY_HOME/nginx
    export PATH=\$PATH:\$NGINX_HOME/sbin
    export LUAJIT_HOME=\$OPENRESTY_HOME/luajit
    export PATH=\$LUAJIT_HOME/bin:\$PATH
    EOF

参考