博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
026_nginx引用lua遇到的坑
阅读量:5057 次
发布时间:2019-06-12

本文共 3439 字,大约阅读时间需要 11 分钟。

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 listInstalled rocks:----------------lua-resty-iputils   0.3.0-1 (installed) - /usr/local/lib/luarocks/rocksluasocket   3.0rc1-2 (installed) - /usr/local/lib/luarocks/rockslyaml   6.1.1-4 (installed) - /usr/local/lib/luarocks/rocks]$ sudo luarocks remove luasocket]$ sudo vim nginx.conferror_log /data/log/nginx/error.log debug   #把debug日志打开]$ sudo /opt/nginx/sbin/nginx -tthe configuration file /opt/nginx/conf/nginx.conf syntax is oknginx: [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 chunkconfiguration 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进行测试查询是否有问题(有问题需要及时修复)。

 

转载于:https://www.cnblogs.com/itcomputer/p/8884339.html

你可能感兴趣的文章
[转] Transformer图解
查看>>
SpringMVC_HelloWorld_03
查看>>
357. Count Numbers with Unique Digits
查看>>
POJ 3660Cow Contest
查看>>
FreeBSD方式安装 MAC OSX
查看>>
Linux 根文件系统制作
查看>>
IOS--沙盒机制
查看>>
My.Ioc 的性能
查看>>
使用 JointCode.Shuttle 访问任意 AppDomain 的服务
查看>>
hdoj 1846 Brave Game(巴什博弈)
查看>>
Round #345 B. Beautiful Paintings(Div.2)
查看>>
51nod 1018排序
查看>>
sqlite的坑
查看>>
Elastic Search 上市了,市值翻倍,这群人财务自由了!
查看>>
digitalocean --- How To Install Apache Tomcat 8 on Ubuntu 16.04
查看>>
linux swoole
查看>>
An Easy Problem?! - POJ 2826(求面积)
查看>>
修改服务器端口号
查看>>
摄影网站汇总
查看>>
【题解】[P4178 Tree]
查看>>