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 包管理尝鲜

     

  • 相关阅读:
    在python3中安装mysql扩展,No module named 'ConfigParser'
    Ubuntu安装MySQL和Python库MySQLdb步骤
    python_非阻塞套接字及I/O流
    EFI、UEFI、MBR、GPT的区别
    2018.1.9 博客迁移至csdn
    2017.12.27 sqlSessionFactory和sqlSession(to be continued)
    2017.12.25 Mybatis物理分页插件PageHelper的使用(二)
    2017.12.14 Mybatis物理分页插件PageHelper的使用(一)
    2017.12.12 架构探险-第一章-从一个简单的web应用开始
    2017.12.11 线程池的简单实践
  • 原文地址:https://www.cnblogs.com/tinywan/p/7919472.html
Copyright © 2011-2022 走看看