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. [Android] Android最简单ScrollView和ListView滚动冲突解决方案

    [Question]问题描述: 单独的ListView列表能自动垂直滚动,但当将ListView嵌套在ScrollView后,会和ScrollView的滚动滑块冲突,造成ListView滑块显示不完整 ...

  2. Java通过cal.get(Calendar.MONTH)比真实月份少一个月

    Calendar cal = Calendar.getInstance();假如当前是12月,cal.get(cal.MONTH)是11月.

  3. Android弹出窗口

    protected void PopUp() { final PopupWindow popup = new PopupWindow(TestActivity.this); View popView ...

  4. 【转】Parcelable, Serializable,Cloneable,copyProperties

    Copying ... https://blog.csdn.net/max2005/article/details/78325036 存在着三件事,整理如下 Parcelable, Serializa ...

  5. arcgis中的geodatabase模型

    简介Geodatabase是ESRI公司定义的一个为ArcGIS所用的数据框架,该框架定义了ArcGIS中用到的所有的数据类型.不管ArcGIS的数据存储到何处.以什么格式存储,都脱离不了该框架.也可 ...

  6. 从一个数组对象中取key 和value组成一个新的对象

    const type = [ {key:'TimeWeiDu',value:'时间维度'}, {key:'TranType',value:'交易类型'}, {key:'OrderType',value ...

  7. linux 根据Pid获取 进程内容

    ps -ef | grep 753 | grep -v 'grep' | awk '{print $NF}'

  8. Flask中Mysql数据库的常见操作

    from flask import Flask,render_template #导入第三方链接库sql点金术 from flask_sqlalchemy import SQLAlchemy #建立对 ...

  9. MyBatis中---数据库配置的属性名冲突问题

    一.db.properties 属性文件中 最好加特殊的标志前缀  jdbc.username ,如果单纯的username有可能影响到 mapper.xml中的 ${username}; 举例   ...

  10. DeepLearning.ai-Week1-Convolution+model+-+Application

    1.0 - TensorFlow model 导入相关依赖包. import numpy as np import h5py import matplotlib.pyplot as plt impor ...