日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

Openresty 学习笔记(一)opm 工具的使用

發布時間:2023/12/19 综合教程 26 生活家
生活随笔 收集整理的這篇文章主要介紹了 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 包管理嘗鮮

總結

以上是生活随笔為你收集整理的Openresty 学习笔记(一)opm 工具的使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。