人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動(dòng)態(tài)

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

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

安裝 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) 模塊是一個(gè)拓展 nginx 服務(wù)器核心功能的模塊,第三方模塊開(kāi)發(fā)可以基于它來(lái)快速實(shí)現(xiàn)。 NDK 提供函數(shù)和宏處理一些基本任務(wù), 減輕第三方模塊開(kāi)發(fā)的代碼量

下載 lua-nginx-module 模塊

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

lua-nginx-module 模塊使 nginx 中能直接運(yùn)行 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

進(jìn)入 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。

編譯報(bào)錯(cuò)應(yīng)該就是 lua 環(huán)境變量不對(duì)。

nginx -V 命令報(bào)錯(cuò)
./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 查看,無(wú)報(bào)錯(cuò)即可。

把原來(lái)的 nginx 備份為 nginx_old

cp objs/nginx 到原來(lái)的 nginx 并覆蓋。

在編譯目錄執(zhí)行

make upgrade

Nginx 添加 lua 模塊

測(cè)試:

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

瀏覽器打開(kāi):

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

可以看到 hello, lua!

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持本站。

香港服務(wù)器租用

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

相關(guān)文章

實(shí)時(shí)開(kāi)通

自選配置、實(shí)時(shí)開(kāi)通

免備案

全球線路精選!

全天候客戶(hù)服務(wù)

7x24全年不間斷在線

專(zhuān)屬顧問(wèn)服務(wù)

1對(duì)1客戶(hù)咨詢(xún)顧問(wèn)

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部