五月综合激情婷婷六月,日韩欧美国产一区不卡,他扒开我内裤强吻我下面视频 ,无套内射无矿码免费看黄,天天躁,日日躁,狠狠躁

新聞動態(tài)

Nginx添加lua模塊的實現(xiàn)方法

發(fā)布日期:2022-02-20 12:23 | 文章來源:源碼中國

安裝 lua

wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz 
tar -zxvf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
make && make install PREFIX=/usr/local/LuaJIT

etc/profile 加入

# lua
export LUAJIT_LIB=/usr/local/LuaJIT/lib 
export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0

source etc/profile

下載 ngx_devel_kit 模塊

wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz

NDK (nginx development kit) 模塊是一個拓展 nginx 服務器核心功能的模塊,第三方模塊開發(fā)可以基于它來快速實現(xiàn)。 NDK 提供函數(shù)和宏處理一些基本任務, 減輕第三方模塊開發(fā)的代碼量

下載 lua-nginx-module 模塊

wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc7.tar.gz 

lua-nginx-module 模塊使 nginx 中能直接運行 lua

查看原始編譯

nginx -V

如:
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_sub_module --with-http_v2_module

進入 nginx 原始目錄:

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_sub_module --with-http_v2_module --add-module=/root/lua-nginx-module-0.10.9rc7/ --add-module=/root/ngx_devel_kit-0.3.0

只 make,不執(zhí)行 make install。

編譯報錯應該就是 lua 環(huán)境變量不對。

nginx -V 命令報錯
./nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
解決:
echo "/usr/local/LuaJIT/lib" >> /etc/ld.so.conf
ldconfig

成功之后可以 nginx -V 查看,無報錯即可。

把原來的 nginx 備份為 nginx_old

cp objs/nginx 到原來的 nginx 并覆蓋。

在編譯目錄執(zhí)行

make upgrade

Nginx 添加 lua 模塊

測試:

server{
 ...
 location /lua {
  default_type 'text/html';
  content_by_lua '
    ngx.say("hello, lua!")
  ';
 }
 ...
}

瀏覽器打開:

http://blog.13sai.com/lua

可以看到 hello, lua!

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持本站。

香港服務器租用

版權聲明:本站文章來源標注為YINGSOO的內容版權均為本站所有,歡迎引用、轉載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內容涉嫌侵權,請聯(lián)系alex-e#qq.com處理。

實時開通

自選配置、實時開通

免備案

全球線路精選!

全天候客戶服務

7x24全年不間斷在線

專屬顧問服務

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時在線

客服
熱線

400-630-3752
7*24小時客服服務熱線

關注
微信

關注官方微信
頂部