openresty利用lua_package_path来引入moudule模块

1.自定义模块nginx

local my_module={}


function my_module.find_number(a,b)
   return a+b
end

return my_module

2。nginx.conf文件配置(放于http里面的配置)app

lua_package_path "/Users/guanguan/workspace/knifer/?.lua;;";


    server {
        listen       8000;
        server_name  localhost;


        set $path /Users/guanguan/workspace/knifer/app;

 
        location / {
            lua_check_client_abort on;
            access_by_lua_file  $path/main.lua;
        }

    access_log   /usr/local/openresty/nginx/logs/knifer_access.log  main;
    error_log    /usr/local/openresty/nginx/logs/knifer_error.log  debug;
    }

3.引入自定义模块ui

local common = require "lib.utils.common"
相关文章
相关标签/搜索