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遇到的坑的更多相关文章

  1. 在redis一致性hash(shard)中使用lua脚本的坑

    redis 2.8之前的版本,为了实现支持巨量数据缓存或者持久化,一般需要通过redis sharding模式来实现redis集群,普遍大家使用的是twitter开源的Twemproxy. twemp ...

  2. Java引用外部字体(路径引用)的一些坑

    一 原因 后端负责字体...哎,我们公司的前端真的任性啊... 然后,一路踩了jvm关于字体的坑,重点是,java的报错很随意,甚至不报错,建议直接看最后面. 二 代码 正常要windows装一次字体 ...

  3. lua中的坑

    在工作中使用lua也有一年了,代码也写了不少,踩过不少坑,这里记录一下. table.sort table.sort是lua自带的排序函数,数据量小时,也还是不错的.不过要注意你传入的compare函 ...

  4. lua 基础 之 坑一样的地方

    -- local 局部-- local表=全局表,是同一个表,这主要是由于lua的表机制是匿名的,相当于函数的指针,local foo = foo,-- 即使本地foo没有在全局_G注册,还是引用的是 ...

  5. redis Lua学习与坑

    1.在写lua脚本往redis中添加zadd 有序集合的时候一直报 "value is not a valid float"的错误,经过查询相关资料,最后发现,是顺序写反了. 相关 ...

  6. android 解决studio生成aar包并在其他工程引用aar包的坑,不需要任何gradle配置

    1.首先我们创建一个module 2.编写我们的一个类 3.编译我们的module,生成release版本的aar,注意千万不要是debug版本的, 点击最右边的gradle面板,选择我们的modul ...

  7. 【原创】面向对象作业:选课系统中用pickle储存多个对象间组合引用关系的那些坑

    转载请注明出处:https://www.cnblogs.com/oceanicstar/p/9030121.html 想直接看结论先提前列出: 1.存储一个对象,文件不是真的给你存储的了对象这种东西, ...

  8. gradle 多模块Springboot项目 compile project引用其他模块的坑

    本来以为子项目中compile project(':xxx'),就能引用其他模块了,因为之后idea也没在引用时候标红 然而我gradle build的时候,居然各种找不到引用模块的类 最后在stac ...

  9. PHP循环引用会遇到的坑

    今天遇到这样一个问题: 如果foreach循环一个数组,引用去对它的元素做一些操作,会有什么问题吗? 比如 [1, 2, 3],foreach循环的时候,引用给每个元素 * 2,再去foreach输出 ...

随机推荐

  1. git的那些事

    前言:记得在想学习git的时候,一直停留在思想的层面,总没有弄清楚它的运行机制,经常与github混淆,还好找到了一个好的教程,带我领略了git的风采 (一)git的优点 git的优点:版本控制在本地 ...

  2. Uncaught DOMException: Failed to construct 'WebSocket': The URL '/qibao/websocket/service1000' is invalid.

    出现这个问题是构造 WebSocket失败了. js代码改成 //实现化WebSocket对象,指定要连接的服务器地址与端口 建立连接//等同于socket = new WebSocket(path+ ...

  3. 【1】[leetcode-124] 二叉树中的最大路径和

    (没做出来,典型题目重要) 二叉树中的最大路径和(hard) 给定一个非空二叉树,返回其最大路径和. 本题中,路径被定义为一条从树中任意节点出发,达到任意节点的序列.该路径至少包含一个节点,且不一定经 ...

  4. ZOJ - 3261 Connections in Galaxy War(并查集删边)

    https://cn.vjudge.net/problem/ZOJ-3261 题意 银河系各大星球之间有不同的能量值, 并且他们之间互相有通道连接起来,可以用来传递信息,这样一旦有星球被怪兽攻击,便可 ...

  5. vue 组件数据传递

    vue组件化开发 主要为了把一个大功能拆分成若干个小的功能,解决高耦合问题,同时也方便开发人员维护.   从功能上组件可以分为木偶组件和功能组件. 木偶组件(为了接收数据,渲染数据,基本上是没有逻辑的 ...

  6. thinkcmf 相关

    后台登录,暂停关掉登录验证码: /Volumes/macHD2/myCode/wwwroot/app/admin/controller/PublicController.php $captcha = ...

  7. dubbo 初探

    dubbo官网:http://dubbo.io Dubbo背景和简介(摘自 http://blog.csdn.net/noaman_wgs/article/details/70214612) Dubb ...

  8. Chrome之控制台使用【转载】

    原文链接:https://segmentfault.com/a/1190000002511877 关键API: console.log(); console.info(); console.warn( ...

  9. cpp #,##

    #define语句中的#是把参数字符串化,##是连接两个参数成为一个整体. #define FACTORY_REF(name) { #name, Make##name } 中#name就是将传入的na ...

  10. AttributeError: module '__main__' has no attribute 'main'解决方法

    在终端运行.py文件时报错:AttributeError: module '__main__' has no attribute 'main' 原因:在PyCharm里运行python程序需要添加 i ...