1.自定义模块
local my_module={}
function my_module.find_number(a,b)
return a+b
end
return my_module
2。nginx.conf文件配置(放于http里面的配置)
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.引入自定义模块
local common = require "lib.utils.common"