openresty部署

本文介绍openresty的部署以及lua脚本的关联

准备

drizzle7-2011.07.21.tar.gz
openresty-1.13.6.2.tar.gz

部署

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
yum install pcre-devel openssl-devel gcc gcc-c++ -y
cd `dirname $0`
tar xvf drizzle7-2011.07.21.tar.gz
cd drizzle7-2011.07.21
./configure --without-server
make libdrizzle-1.0
make install-libdrizzle-1.0
cd ..
tar xvf openresty-1.13.6.2.tar.gz
cd openresty-1.13.6.2
./configure --with-luajit --with-http_drizzle_module --with-http_iconv_module --with-ld-opt="-Wl,-rpath,/usr/local/lib" --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module
gmake
gmake install

配置lua脚本

  • 在 nginx/nginx.conf配置中的http模块下声明外部配置

    1
    2
    lua_code_cache off;
    include /usr/local/openresty/config/*.conf;
  • /usr/local/openresty/config路径下创建配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    server {
    listen 9999;
    server_name 127.0.0.1;
    access_log /var/log/dev_bus_access_80.log;
    location /portal {
    default_type application/json;
    content_by_lua_file /usr/local/openresty/lua/redirect.lua;
    }
    }
  • /usr/local/openresty/lua/redirect.lua创建lua脚本
    以上完成

启动nginx

nginx/sbin/nginx

ulysses wechat
订阅+