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. ubuntu linux下建立stm32开发环境: 程序烧录 openocd+openjtag

    原文出处: http://blog.csdn.net/embbnux/article/details/17619621 之前建立stm32开发环境,程序也已经编译好生成main.bin,接下来就是要把 ...

  2. PHP7 学习笔记(十二)gRPC

    GitHub:https://github.com/grpc/grpc/tree/master/src/php 环境:Linux + php7 1.安装grpc pecl install grpc 编 ...

  3. solrj管理索引库

    solrj管理索引库 1.1. 什么是solrJ solrj是访问Solr服务的java客户端,提供索引和搜索的请求方法,SolrJ通常在嵌入在业务系统中,通过SolrJ的API接口操作Solr服务, ...

  4. tedu训练营day03

    Day03笔记1.作业 1.假如你现在25周岁,每年365天,计算你过了多少个星期天(大概数字) 提示 :地板除 2.毕业薪资为10000元,每年涨20%,十年之后你的薪资为多少元? 提示: 幂运算( ...

  5. 对空间数据(Shape)重新排序

    打开ArcToolBox,数据管理工具->常规(General)->排序

  6. VS2019预览版发布了

     VS2019正式版已发布:https://www.cnblogs.com/zhaogaojian/p/10648904.html 1.点击下载https://visualstudio.microso ...

  7. Nginx 关闭日志生成文件

    nginx 关闭日志:其实一种方法就是写入/dev/null 文件 或者设置关闭: nginx 日志有两个类型  access.log  http 记录访问日志. error.log   server ...

  8. bean的实例化方式

    spring中bean的实例化方式有三种,1.构造器实例化,2.实例工厂实例化,3.静态工厂实例化 1.构造器实例化方式 public class bean1 { public bean1() { } ...

  9. linux下mysql 配置

    su root 加环境变量 在文件末尾加上如下两行代码 PATH=/usr/local/webserver/php/bin:$PATHexport PATH # /etc/profile 保存,重启 ...

  10. 最短路模板(SPFA POJ2387)

    #include <set> #include <map> #include <queue> #include <stack> #include < ...