Openresty 学习笔记(一)opm 工具的使用
1、自1.11.2.2开始,OpenResty版本已经包含并默认安装opm。所以通常你不需要自己安装opm。
2、我们在这里只需要做一个软连接就可以了
cd /usr/local/openresty/bin
sudo ln -s `pwd`/opm /usr/local/bin/opm
3、搜索指定软件包名称
www@TinywanAliYun:~$ opm search session
bungle/lua-resty-session Session Library for OpenResty - Flexible and Secure
4、搜索具有多个模式“lru”和“cache”的软件包名称和摘要。
www@TinywanAliYun:~$ opm search lru cache
openresty/lua-resty-lrucache Lua-land LRU Cache based on LuaJIT FFI
5、在一些作者的名字下安装名为lua-resty-logger-socket的软件包
www@TinywanAliYun:~$ opm get p0pr0ck5/lua-resty-logger-socket* Fetching p0pr0ck5/lua-resty-logger-socket
Downloading https://opm.openresty.org/api/pkg/tarball/p0pr0ck5/lua-resty-logger-socket-0.03.opm.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
--:--:-- --:--:-- --:--:--
Package p0pr0ck5/lua-resty-logger-socket 0.03 installed successfully under /usr/local/openresty/site/ .
结果在 /usr/local/openresty/lualib/resty 目录下没有这个文件下载下来
结果该文件默认下载到以下目录了
/usr/local/openresty/site/lualib/resty
编写代码测试
local uuid = require 'resty.jit-uuid'
ngx.say(uuid())
问题来了,项目中直接应用,报错,提示找不到该文件
[C]: in function 'require'
in function /status"
[error] 7626#7626: init_worker_by_lua error: init_worker_by_lua:2: module 'resty.jit-uuid' not found:
no field package.preload['resty.jit-uuid']
no file '/usr/local/openresty/lualib/resty/jit-uuid.lua'
no file '/usr/local/openresty/nginx/conf/waf/resty/jit-uuid.lua'
no file '/usr/local/openresty/lualib/resty/jit-uuid.so'
no file '/opt/verynginx/verynginx/lua_script/resty/jit-uuid.so'
no file '/usr/local/openresty/site/lualib/resty/jit-uuid.so'
no file '/usr/local/openresty/lualib/resty/jit-uuid.so'
如果复制到该目录下,则是可以正常访问的
/usr/local/openresty/lualib/resty
要想安装到以上目录
则在下载的时候指定安装目录就可以了
opm --install-dir=/usr/local/openresty get thibaultcha/lua-resty-jit-uuid
通过上面这种安装方式,直接在项目中就可以使用
参考
Openresty 学习笔记(一)opm 工具的使用的更多相关文章
- openresty 学习笔记二:获取请求数据
openresty 学习笔记二:获取请求数据 openresty 获取POST或者GET的请求参数.这个是要用openresty 做接口必须要做的事情.这里分几种类型:GET,POST(urlenco ...
- Oracle RAC学习笔记02-RAC维护工具集
Oracle RAC学习笔记02-RAC维护工具集 RAC维护工具集 1.节点层 2.网络层 3.集群层 4.应用层 本文实验环境: 10.2.0.5 Clusterware + RAC 11.2.0 ...
- 并发编程学习笔记(10)----并发工具类CyclicBarrier、Semaphore和Exchanger类的使用和原理
在jdk中,为并发编程提供了CyclicBarrier(栅栏),CountDownLatch(闭锁),Semaphore(信号量),Exchanger(数据交换)等工具类,我们在前面的学习中已经学习并 ...
- TensorFlow学习笔记2-性能分析工具
TensorFlow学习笔记2-性能分析工具 性能分析工具 在spyder中运行以下代码: import tensorflow as tf from tensorflow.python.client ...
- openresty 学习笔记小结:综合应用实例
openresty 学习笔记小结:综合应用实例 这个综合实验实现的功能其实很简单,用户访问一个页面,显示一个默认页面.输入参数(post或者get都可以),如果参数在数据库查询得到并满足一定条件,根据 ...
- openresty 学习笔记六:使用session库
openresty 学习笔记六:使用session库 lua-resty-session 是一个面向 OpenResty 的安全和灵活的 session 库,它实现了 Secure Cookie Pr ...
- openresty 学习笔记番外篇:python的一些扩展库
openresty 学习笔记番外篇:python的一些扩展库 要写一个可以使用的python程序还需要比如日志输出,读取配置文件,作为守护进程运行等 读取配置文件 使用自带的ConfigParser模 ...
- openresty 学习笔记番外篇:python访问RabbitMQ消息队列
openresty 学习笔记番外篇:python访问RabbitMQ消息队列 python使用pika扩展库操作RabbitMQ的流程梳理. 客户端连接到消息队列服务器,打开一个channel. 客户 ...
- openresty 学习笔记五:访问RabbitMQ消息队列
openresty 学习笔记五:访问RabbitMQ消息队列 之前通过比较选择,决定采用RabbitMQ这种消息队列来做中间件,目的舒缓是为了让整个架构的瓶颈环节.这里是做具体实施,用lua访问Rab ...
- openresty 学习笔记四:连接mysql和进行相关操作
openresty 学习笔记四:连接mysql和进行相关操作 毕竟redis是作为缓存,供程序的快速读写,虽然reidis也可以做持久化保存,但还是需要一个做数据存储的数据库.比如首次查询数据在red ...
随机推荐
- jQuery File Upload 图片上传解决方案兼容IE6+
1.下载:https://github.com/blueimp/jQuery-File-Upload 2.命令: npm install bower install ================= ...
- PHP 事务写法
$md=new Model(); //创建事务 $md->startTrans(); //开始事务 $md->table("ym_xxx")->where(&qu ...
- php插入日志到数据库,对象转json
打印插入日志数据到库 M()->table("t_log")->data(array( 'id'=>'6'.time(), 't'=> json_encod ...
- windows刷新本机DNS缓存
ipconfig /flushdns
- 【BZOJ5300】[CQOI2018]九连环 (高精度,FFT)
[BZOJ5300][CQOI2018]九连环 (高精度,FFT) 题面 BZOJ 洛谷 题解 去这里看吧,多么好 #include<iostream> #include<cstdi ...
- 【BZOJ2618】[CQOI2006]凸多边形(半平面交)
[BZOJ2618][CQOI2006]凸多边形(半平面交) 题面 BZOJ 洛谷 题解 这个东西就是要求凸多边形的边所形成的半平面交. 那么就是一个半平面交模板题了. 这里写的是平方的做法. #in ...
- IP地址等价类测试用例
下面是一个比较完善的设计方案,这个方案中,首先把IP地址分成有效可用的IP地址和有效但不可用的IP地址两个等价类:其中有效可用的IP地址中包括IP地址的A,B,C三类地址,有效但不可用的IP地址包括D ...
- luogu3188/bzoj1190 梦幻岛宝珠 (分层背包dp)
他都告诉你能拆了 那就拆呗.把每个重量拆成$a*2^b$的形式 然后对于每个不同的b,先分开做30个背包 再设f[i][j]表示b<=i的物品中 容量为$ j*2^i+W\&((1< ...
- 2017蓝桥杯 省赛D题(方格分割)
6x6的方格,沿着格子的边线剪开成两部分.要求这两部分的形状完全相同. 如图:p1.png, p2.png, p3.png 就是可行的分割法. 试计算:包括这3种分法在内,一共有多少种不同的分割 ...
- 牛客练习赛28 B数据结构(线段树)
链接:https://www.nowcoder.com/acm/contest/200/B来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言5242 ...