026_nginx引用lua遇到的坑
server {
listen 80;
listen 443 ssl;
server_name www.jyall.com;
access_log /data/log/nginx/*.www.jyall.com.access.log ngx_main;
error_log /data/log/nginx/*.www.jyall.com.error.log;
charset utf-8;
underscores_in_headers on;
ssl_certificate ssl/jyall.crt;
ssl_certificate_key ssl/*.www.jyall.com-2018-07-29.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
error_page 400 401 402 403 404 406 = /error404.html;
location = /error404.html {
root /opt/nginx/html;
}
error_page 500 502 503 504 = /error500.html;
location = /error500.html {
root /opt/nginx/html;
}
location ~ ^/get_json {
default_type application/json;
return 200 '{"status":"success","result":"nginx json3"}'; #json测试
}
}
二、
]$ sudo luarocks list
Installed rocks:
----------------
lua-resty-iputils
0.3.0-1 (installed) - /usr/local/lib/luarocks/rocks
luasocket
3.0rc1-2 (installed) - /usr/local/lib/luarocks/rocks
lyaml
6.1.1-4 (installed) - /usr/local/lib/luarocks/rocks
]$ sudo luarocks remove luasocket
]$ sudo vim nginx.conf
error_log /data/log/nginx/error.log debug #把debug日志打开
]$ sudo /opt/nginx/sbin/nginx -t
the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: [error] init_by_lua_file error: /opt/nginx/conf/lua/resty/influxdb.lua:9: module 'socket' not found:
no field package.preload['socket']
no file '/opt/nginx/conf/lua/socket.lua'
no file './socket.lua'
no file '/usr/local/share/luajit-2.0.4/socket.lua'
no file '/usr/local/share/lua/5.1/socket.lua'
no file '/usr/local/share/lua/5.1/socket/init.lua'
no file '/opt/nginx/conf/lua/socket.so'
no file './socket.so'
no file '/usr/local/lib/lua/5.1/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
/opt/nginx/conf/lua/resty/influxdb.lua:9: in main chunk
[C]: in function 'require'
/opt/nginx/conf/lua/init_by_lua.lua:25: in main chunk
configuration file /opt/nginx/conf/nginx.conf test failed
]$ sudo /opt/nginx/sbin/nginx -s reload #但是照样可以reload,而且日志没有任何报错
]$ sudo /opt/nginx/sbin/nginx -d #下边的原先为json改为json3后内存内容也进行了更新
location ~ ^/get_json {
default_type application/json;
return 200 '{"status":"success","result":"nginx json3"}';
}
}
nginx: [error] init_by_lua_file error: /opt/nginx/conf/lua/resty/influxdb.lua:9: module 'socket' not found:
no field package.preload['socket']
no file '/opt/nginx/conf/lua/socket.lua'
no file './socket.lua'
no file '/usr/local/share/luajit-2.0.4/socket.lua'
no file '/usr/local/share/lua/5.1/socket.lua'
no file '/usr/local/share/lua/5.1/socket/init.lua'
no file '/opt/nginx/conf/lua/socket.so'
no file './socket.so'
no file '/usr/local/lib/lua/5.1/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
/opt/nginx/conf/lua/resty/influxdb.lua:9: in main chunk
[C]: in function 'require'
/opt/nginx/conf/lua/init_by_lua.lua:25: in main chunk ]$ sudo curl -H "Host:venus.jyall.com" "127.0.0.1/get_json" #但实际curl的时候还是最老的内容
{"status":"success","result":"nginx json"} 总结:(1)打开nginx debug(2)然后sudo /opt/nginx/sbin/nginx -t进行测试查询是否有问题(有问题需要及时修复)。
026_nginx引用lua遇到的坑的更多相关文章
- 在redis一致性hash(shard)中使用lua脚本的坑
redis 2.8之前的版本,为了实现支持巨量数据缓存或者持久化,一般需要通过redis sharding模式来实现redis集群,普遍大家使用的是twitter开源的Twemproxy. twemp ...
- Java引用外部字体(路径引用)的一些坑
一 原因 后端负责字体...哎,我们公司的前端真的任性啊... 然后,一路踩了jvm关于字体的坑,重点是,java的报错很随意,甚至不报错,建议直接看最后面. 二 代码 正常要windows装一次字体 ...
- lua中的坑
在工作中使用lua也有一年了,代码也写了不少,踩过不少坑,这里记录一下. table.sort table.sort是lua自带的排序函数,数据量小时,也还是不错的.不过要注意你传入的compare函 ...
- lua 基础 之 坑一样的地方
-- local 局部-- local表=全局表,是同一个表,这主要是由于lua的表机制是匿名的,相当于函数的指针,local foo = foo,-- 即使本地foo没有在全局_G注册,还是引用的是 ...
- redis Lua学习与坑
1.在写lua脚本往redis中添加zadd 有序集合的时候一直报 "value is not a valid float"的错误,经过查询相关资料,最后发现,是顺序写反了. 相关 ...
- android 解决studio生成aar包并在其他工程引用aar包的坑,不需要任何gradle配置
1.首先我们创建一个module 2.编写我们的一个类 3.编译我们的module,生成release版本的aar,注意千万不要是debug版本的, 点击最右边的gradle面板,选择我们的modul ...
- 【原创】面向对象作业:选课系统中用pickle储存多个对象间组合引用关系的那些坑
转载请注明出处:https://www.cnblogs.com/oceanicstar/p/9030121.html 想直接看结论先提前列出: 1.存储一个对象,文件不是真的给你存储的了对象这种东西, ...
- gradle 多模块Springboot项目 compile project引用其他模块的坑
本来以为子项目中compile project(':xxx'),就能引用其他模块了,因为之后idea也没在引用时候标红 然而我gradle build的时候,居然各种找不到引用模块的类 最后在stac ...
- PHP循环引用会遇到的坑
今天遇到这样一个问题: 如果foreach循环一个数组,引用去对它的元素做一些操作,会有什么问题吗? 比如 [1, 2, 3],foreach循环的时候,引用给每个元素 * 2,再去foreach输出 ...
随机推荐
- 完美解决distinct中使用多个字段的方法
众所周知,distinct可以列出不重复的记录,对于单个字段来说distinct使用比较简单,但是对于多个字段来说,distinct使用起来会使人发狂.而且貌似也没有见到微软对distinct使用多字 ...
- Oracle数据库用户锁定原因以及处理方式(ORA-28000)
现场在实施过程中,基于安全考虑(用户名和密码之前暴露给其他公司了),需要对用户密码进行修改. 修改过程很简单(alter user [username] identified by [password ...
- python 单例模式总结
参考 # 第一种方法 new 方法 class Singleton(object): def __new__(cls,*args,**kw): if not hasattr(cls,'_instanc ...
- 049、准备overlay网络实验环境(2019-03-14 周四)
参考https://www.cnblogs.com/CloudMan6/p/7270551.html 为了支持容器跨主机通信,Docker提供了overlay driver,使用户可以创建基于Vx ...
- 将WORD2010文件标记为最终状态
将WORD2010文件标记为最终状态 在与他人共享WORD2010文档的副本之前,可以使用“标记为最终状态”命令将文件设置为只读,防止他人对文件进行更改.在将文件标记为最终状态后,键入.编辑命令以及校 ...
- docker之搭建私有镜像仓库和公有仓库
一.搭建私有仓库 1.docker pull registry #下载registry镜像并启动 2. docker run -d -v /opt/registry:/var/lib/registry ...
- 关于hashMap中 计算hashCode的逻辑推理(二)
hashMap中,为了使元素在数组中尽量均匀的分布,所以使用取模的算法来决定元素的位置.如下: //方法一: static final int hash(Object key){//jdk1.8 in ...
- 【译】第十一篇 SQL Server安全审核
本篇文章是SQL Server安全系列的第十一篇,详细内容请参考原文. SQL Server审核SQL Server审核是指你可以在数据库或服务器实例监控事件.审核日志包含你选择捕获的事件的列表,在服 ...
- 技巧性极强的strings命令
打印文件中的可打印字符串(print the strings of printable characters in files).常用来在二进制文件中查找字符串,与grep配合使用.strings命令 ...
- learn
1.JQ (随时) 2.微信小程序(关注群,专栏知乎,自己申请一个小程序弄个实战) 3.支付宝小程序(2017.08.18 新生代 类似微信api) 4.vue(优秀的mvvm框架,手机端主流) 5. ...