zoukankan      html  css  js  c++  java
  • 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
    100  7423  100  7423    0     0  23691      0 --:--:-- --:--:-- --:--:-- 23715
    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  

    通过上面这种安装方式,直接在项目中就可以使用

    参考

    1、OpenResty 大跃进! opm 包管理尝鲜

     

  • 相关阅读:
    java_爬虫_从腾讯视频播放界面爬取视频真实地址
    杂_小技巧_将网页上的内容通过亚马逊邮箱传到kindle中
    java_基础_接口和抽象类
    知乎上的50道SQL练习题
    第 4 章 WebDriver API
    第 2 章 测试环境搭建
    第 1 章 自动化测试基础
    【软件测试】9.QC管理学习(类禅道)学习
    01 Python简介、环境安装、变量、数据类型
    【MySQL面试指南】
  • 原文地址:https://www.cnblogs.com/tinywan/p/7919472.html
Copyright © 2011-2022 走看看