Open wanghaisheng opened 8 years ago
https://github.com/APItools/router.lua postgrest 套这个router
local function json_encode(data, empty_table_as_object)
local json_value
if json.encode_empty_table_as_object then
json.encode_empty_table_as_object(empty_table_as_object or false) -- 空的table默认为array
end
if require("ffi").os ~= "Windows" then
json.encode_sparse_array(true)
end
pcall(function(data) json_value = json.encode(data) end, data)
return json_value
end
lua 报文格式转换 模板 https://github.com/leafo/etlua
有时候当Nginx读取本地目录时会收到403错误,权限问题。
先来了解一下Nginx的用户管理,Nginx在以Linux service脚本启动时,通过start-stop-domain启动,会以root权限运行daemon进程。
然后daemon进程读取/etc/nginx/nginx.conf文件中的user配置选项,默认这里的user=nginx
也就是用nginx用户启动worker process。403错误就是因为nginx用户没有权限访问我当前开发用的用户目录,/home/dean/work/resources。
解决方法是将user=nginx替换成root,然后重新启动nginx,可以了。
其他方法也试过,比如给/home/dean/work/resources目录设置777权限,比如将nginx用户加入root组,都不行。
所以当开发的时候,就用user=root配置吧。至于产品环境下,resouces目录完全可以放到nginx用户目录下,所以问题不大。
使用ngx.thread.spawn读取cda文档中涉及到的节点数据并给变量赋值
https://groups.google.com/forum/#!topic/openresty/MlbEIgTBAN0
http://chattool.sinaapp.com/?p=939 Nginx+Lua开发入门
ngx.print ngx.say 有什么区别 流石 2016/4/14 13:43:13 say 换行, print 不换行
https://github.com/suzel/docker-postgrest https://github.com/quiklyn/docker-openresty