国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Nginx > 正文

Nginx安裝lua-nginx-module模塊的方法步驟

2024-08-30 12:30:06
字體:
來源:轉載
供稿:網友

ngx_lua_module 是一個nginx http模塊,它把 lua 解析器內嵌到 nginx,用來解析并執行lua 語言編寫的網頁后臺腳本

特性很牛叉,可自行百度查看,這里主要是示范一下,如何在Nginx下安裝lua-nginx-module模塊

當然,如果你之前沒有安裝過Nginx,而且嫌安裝麻煩,可直接下載openresty安裝簡單快捷,http://openresty.org/cn/installation.html(阿里的大牛章亦春的作品,膜拜~~~)

1.下載安裝LuaJIT 2.1(2.0或者2.1都是支持的,官方推薦2.1):http://luajit.org/download.html

cd /usr/local/srcwget http://luajit.org/download/LuaJIT-2.1.0-beta2.tar.gztar zxf LuaJIT-2.1.0-beta2.tar.gzcd LuaJIT-2.1.0-beta2make PREFIX=/usr/local/luajitmake install PREFIX=/usr/local/luajit

2.下載ngx_devel_kit(NDK)模塊 :https://github.com/simpl/ngx_devel_kit/tags,不需要安裝

cd /usr/local/srcwget https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gztar -xzvf v0.2.19.tar.gz

3.下載最新的lua-nginx-module 模塊 :https://github.com/openresty/lua-nginx-module/tags,不需要安裝

cd /usr/local/srcwget https://github.com/openresty/lua-nginx-module/archive/v0.10.2.tar.gztar -xzvf v0.10.2.tar.gz

4.nginx -V查看已經編譯的配置

nginx -V

筆者的配置如下:

 

復制代碼代碼如下:
--prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-1.0.2h --with-pcre=../pcre-8.38 --with-pcre-jit --with-ld-opt=-ljemalloc --with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib --add-module=/usr/local/src/ngx_devel_kit-0.2.19 --add-module=/usr/local/src/lua-nginx-module-0.10.2

 

5.進入之前安裝nginx的解壓目錄,重新編譯安裝(在nginx -V得到的配置下,加入ngx_devel_kit-0.2.19和ua-nginx-module-0.10.2的目錄),最終的配置如下:

設置環境變量

export LUAJIT_LIB=/usr/local/luajit/libexport LUAJIT_INC=/usr/local/luajit/include/luajit-2.1

 

復制代碼代碼如下:
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-1.0.2h --with-pcre=../pcre-8.38 --with-pcre-jit --with-ld-opt='-ljemalloc' --with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib" --add-module=/usr/local/src/ngx_devel_kit-0.2.19 --add-module=/usr/local/src/lua-nginx-module-0.10.2

 

6.編譯安裝

make -j2make install

7.查看是否編譯成功

在/usr/local/nginx/conf/nginx.conf中加入如下代碼:

location /hello_lua {    default_type 'text/plain';    content_by_lua 'ngx.say("hello, lua")'; }

重啟nginx:

service nginx restart

訪問10.211.55.3/hello_lua會出現”hello, lua”表示安裝成功

hello, lua

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


注:相關教程知識閱讀請移步到服務器教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 娄烦县| 页游| 徐水县| 开化县| 汉中市| 石河子市| 河东区| 河间市| 天气| 阳江市| 宜州市| 长武县| 南平市| 盐源县| 襄汾县| 瑞金市| 民和| 淮安市| 卢氏县| 惠州市| 西昌市| 云林县| 大足县| 图木舒克市| 黄龙县| 宜宾市| 乐至县| 松江区| 武安市| 锡林浩特市| 望都县| 禹州市| 木兰县| 龙州县| 黄浦区| 衡东县| 弥渡县| 习水县| 博爱县| 且末县| 城固县|