tengine+lua 安裝及問題解決

一、tengine+lua集成安裝

1.首先安裝pcre、openssl

2.修改tengine安裝包中 tengine-2.2.2/auto/lib/openssl/conf文件中的openssl路徑,配置文件中路徑包含/.openssl/,如usr/local/opt/openssl/.openssl/include/openssl/ssl.h,實際路徑中不包含

--3./configure --prefix=tengine要安裝到的目錄 --with-pcre=pcre的安裝包目錄  --with-openssl=/usr/local/opt/openssl

具體安裝步驟:

3.先安裝1、2條nginx安裝前置依賴

4.安裝luajit

下載luajit安裝包,執行命令 :make && make install

5.下載luamodule: ngx_devel_kit 、nginx_lua_module

6.安裝tengine

# tell nginx's build system where to find LuaJIT 2.1:

export LUAJIT_LIB=/usr/local/lib

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

# Here we assume Nginx is to be installed under /work/program/tengine

./configure --prefix=/work/program/tengine --with-pcre=/work/soft/pcre-8.38 --with-openssl=/usr/local/opt/openssl --with-ld-opt=-Wl,-rpath,/usr/local/lib --add-module=/work/program/lua-nginx-module-master --add-module=/work/program/ngx_devel_kit-master

sudo make -j2

sudo make install

7.安裝lua-cjson

修改Makefile 文件內容,否則(mac下)會出現錯誤 Undefined symbols for architecture x86_64:

原:CJSON_LDFLAGS =     -shared
改:CJSON_LDFLAGS =     -bundle -undefined dynamic_lookup
這裏就是OSX和Unix的區別,bundle是Mac使用的文件格式,如果不使用這些選項,可能引起“multiple lua vms detected”錯誤

LUA_INCLUDE_DIR = $(PREFIX)/include/luajit-2.0

註釋掉
FPCONV_OBJS =       fpconv.o 

添加:
FPCONV_OBJS =       g_fmt.o dtoa.o
CJSON_CFLAGS +=     -DUSE_INTERNAL_FPCONV
CJSON_CFLAGS +=     -DIEEE_BIG_ENDIAN
CJSON_CFLAGS +=     -pthread -DMULTIPLE_THREADS 

執行命令:make && make install

 

 

安裝luamodule:ngx_devel_kit 、nginx_lua_module

具體查看tengine 動態語言支持lua:https://github.com/alibaba/tengine/blob/master/modules/ngx_http_lua_module/README.markdown4.sudo make

 

二、request: "GET /favicon.ico HTTP/1.1"

favicon.ico 文件是瀏覽器收藏網址時顯示的圖標,當第一次訪問頁面時,瀏覽器會自動發起請求獲取頁面的favicon.ico文件。

nginx可以配置個該文件訪問路徑,也可以nginx配置忽略favicon.ico日誌

location = /favicon.ico { log_not_found off; access_log off; }

 

三、ffi引用的相關問題

引用最新版的lua-resty-core

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章