http://www.ttlsa.com/nginx/nginx-modules-ngx_lua/ nginx lua模組淘寶開發的nginx第三方模組,它能將lua語言嵌入到nginx配置中,從而使用lua就極大增強了nginx的能力.nginx以高並發而知名,lua腳本輕便,兩者的搭配堪稱完美.接下來請看如何安裝nginx + ngx_lua模組.以及最後來個簡單的測試.如果你是ubuntu系統,請看nginx+lua+redis構建高並發應用系統環境:centos/redhat安裝前準備好如下軟體包· nginx 網址:http://www.nginx.org· luajit 網址:http://luajit.org/download.html· HttpLuaModule 網址:http://wiki.nginx.org/HttpLuaModule1. 下載安裝LuaJIT 14 7891011 121314# cd /usr/local/src#get/203a. # tar -xzvf LuaJIT-2.0.2.tar.gz # cd LuaJIT-2.0.2# make Successfully built LuaJITmake[1]:Leaving local/src/ LuaJIT-2.0.2/src'=== 2.0.2= ===# make install出現如下內容,表示安裝成功==== ilcc 2.0.2 to /usr/local=local 2. 下載準備nginx lua模組 12312 cd /usr/local/src# wget https://github.com/chaoslawful/lua-nginx-module/archive/v0.8.6.tar.gz# tar -xzvf v0.8.6 3. 安裝nginx3.1 安裝 4 5 6 78 910910# cd /usr/local/src/ # wget http://p # tar -xzvf nginx-1.4.2.tar.gz # cd nginx-1.4.2//先導入環境變數,告訴nginx去哪裡找/usr/local/lib# export LUAJIT_INC=/usr/local/include/luajit-2.0# ./configure --prefix=/usr/ccal/inx-1. module=../lua-nginx-module-0.8.6# make -j2# make install # make install 3.1 # /usr/local/nginx-1.4.2/sbin/nginx -v . / objs/ nginxobjs whileloading shared libraries:libluajit-5.1.so.2:5.1.so.2: open shared objectfile:No such file ordirectory解決方法:# ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2 4. nginx lua設定nginx設定檔加入以下設定:1 3 4 location~* ^/ { default _type'text/plain'; content_by_ ;} 5. 啟動測試5.1 啟動ng 1 # /usr/local/nginx-1.4.2/sbin/nginx 5.2 訪問測試 1 curl http://test.ttlsa.com/2328/ hello, ttlsa lua//使用curl測試 _lua的安裝到此結束轉載請註明出處: http://www.ttlsa.com/html/2328.html 以上就介紹了nginx + ngx_lua安裝測試,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。