0x01 需求
waf本身有測試環(huán)境,但是在公司內(nèi)網(wǎng)执解,我有的時候在家比較有空寞肖,所以需要一個測試環(huán)境在本機(jī),同時也方便測試衰腌。之前在本地搭建過nginx新蟆,編譯安裝,沒啥問題右蕊,自己本身對nginx還算了解琼稻,故障排查啥的都不是大問題,然后抱著這個想法就搞起來了饶囚。
0x02 過程
剛開始比較簡單帕翻,就是下個lua,然后安裝坯约,過程不多說熊咽,直接搞下。
[root@localhost ~]# wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz
--2017-02-15 17:30:30-- http://luajit.org/download/LuaJIT-2.0.4.tar.gz
Resolving luajit.org... 163.172.177.144
Connecting to luajit.org|163.172.177.144|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 847615 (828K) [application/octet-stream]
Saving to: `LuaJIT-2.0.4.tar.gz'
100%[======================================>] 847,615 309K/s in 2.7s
2017-02-15 17:30:33 (309 KB/s) - `LuaJIT-2.0.4.tar.gz' saved [847615/847615]
安裝:
[root@localhost ~]# tar xvf LuaJIT-2.0.4.tar.gz
[root@localhost ~]# cd LuaJIT-2.0.4
[root@localhost LuaJIT-2.0.4]# ls
COPYRIGHT doc dynasm etc Makefile README src
[root@localhost LuaJIT-2.0.4]# make
==== Building LuaJIT 2.0.4 ====
make -C src
make[1]: Entering directory `/root/LuaJIT-2.0.4/src'
HOSTCC host/minilua.o
......
OK Successfully built LuaJIT
make[1]: Leaving directory `/root/LuaJIT-2.0.4/src'
==== Successfully built LuaJIT 2.0.4 ====
[root@localhost LuaJIT-2.0.4]# make install
==== Installing LuaJIT 2.0.4 to /usr/local ====
mkdir -p /usr/local/bin /usr/local/lib /usr/local/include/luajit-2.0 /usr/local/share/man/man1 /usr/local/lib/pkgconfig /usr/local/share/luajit-2.0.4/jit /usr/local/share/lua/5.1 /usr/local/lib/lua/5.1
cd src && install -m 0755 luajit /usr/local/bin/luajit-2.0.4
cd etc && sed -e "s|^prefix=.*|prefix=/usr/local|" -e "s|^multilib=.*|multilib=lib|" luajit.pc > luajit.pc.tmp && \
install -m 0644 luajit.pc.tmp /usr/local/lib/pkgconfig/luajit.pc && \
rm -f luajit.pc.tmp
cd src && install -m 0644 lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h /usr/local/include/luajit-2.0
cd src/jit && install -m 0644 bc.lua v.lua dump.lua dis_x86.lua dis_x64.lua dis_arm.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua bcsave.lua vmdef.lua /usr/local/share/luajit-2.0.4/jit
ln -sf luajit-2.0.4 /usr/local/bin/luajit
==== Successfully installed LuaJIT 2.0.4 to /usr/local ====
然后完事闹丐,lua安裝是最簡單的,沒啥可說的被因。
然后就是tengine的安裝卿拴,這個過程比較坎坷衫仑,只記錄命令,具體不print了堕花。
tar xvf tengine-2.2.0.tar.gz
cd tengine-2.2.0
./configure --with-http_lua_module --with-luajit-lib=/usr/local/lib/ --with-luajit-inc=/usr/local/include/luajit-2.0/ --with-lua-inc=/usr/local/include/luajit-2.0/ --with-lua-lib=/usr/local/lib/
make || make install
0x03 坑來了
這會安裝遇到一個問題文狱,如下:
[root@localhost sbin]# ./nginx -m
./nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
最后解決了
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
0x04 結(jié)束
解決之后,nginx -m 看看加載的模塊缘挽,對應(yīng)下有木有l(wèi)ua的模塊瞄崇,有就完事了。
nginx: loaded modules:
nginx: ngx_core_module (static)
nginx: ngx_errlog_module (static)
nginx: ngx_conf_module (static)
nginx: ngx_dso_module (static)
nginx: ngx_events_module (static)
nginx: ngx_event_core_module (static)
nginx: ngx_epoll_module (static)
nginx: ngx_procs_module (static)
nginx: ngx_proc_core_module (static)
nginx: ngx_openssl_module (static)
nginx: ngx_regex_module (static)
nginx: ngx_http_module (static)
nginx: ngx_http_core_module (static)
nginx: ngx_http_log_module (static)
nginx: ngx_http_upstream_module (static)
nginx: ngx_http_static_module (static)
nginx: ngx_http_autoindex_module (static)
nginx: ngx_http_index_module (static)
nginx: ngx_http_auth_request_module (static)
nginx: ngx_http_auth_basic_module (static)
nginx: ngx_http_access_module (static)
nginx: ngx_http_limit_conn_module (static)
nginx: ngx_http_limit_req_module (static)
nginx: ngx_http_geo_module (static)
nginx: ngx_http_map_module (static)
nginx: ngx_http_split_clients_module (static)
nginx: ngx_http_referer_module (static)
nginx: ngx_http_rewrite_module (static)
nginx: ngx_http_ssl_module (static)
nginx: ngx_http_proxy_module (static)
nginx: ngx_http_fastcgi_module (static)
nginx: ngx_http_uwsgi_module (static)
nginx: ngx_http_scgi_module (static)
nginx: ngx_http_memcached_module (static)
nginx: ngx_http_empty_gif_module (static)
nginx: ngx_http_browser_module (static)
nginx: ngx_http_user_agent_module (static)
nginx: ngx_http_upstream_hash_module (static)
nginx: ngx_http_upstream_ip_hash_module (static)
nginx: ngx_http_upstream_consistent_hash_module (static)
nginx: ngx_http_upstream_check_module (static)
nginx: ngx_http_upstream_least_conn_module (static)
nginx: ngx_http_upstream_keepalive_module (static)
nginx: ngx_http_upstream_dynamic_module (static)
nginx: ngx_http_stub_status_module (static)
nginx: ngx_http_write_filter_module (static)
nginx: ngx_http_header_filter_module (static)
nginx: ngx_http_chunked_filter_module (static)
nginx: ngx_http_range_header_filter_module (static)
nginx: ngx_http_gzip_filter_module (static)
nginx: ngx_http_postpone_filter_module (static)
nginx: ngx_http_ssi_filter_module (static)
nginx: ngx_http_charset_filter_module (static)
nginx: ngx_http_userid_filter_module (static)
nginx: ngx_http_footer_filter_module (static)
nginx: ngx_http_trim_filter_module (static)
nginx: ngx_http_headers_filter_module (static)
nginx: ngx_http_upstream_session_sticky_module (static)
nginx: ngx_http_reqstat_module (static)
nginx: ngx_http_lua_module (static) ------------------ 就這個貨:韭K昭小!腮郊!
nginx: ngx_http_copy_filter_module (static)
nginx: ngx_http_range_body_filter_module (static)
nginx: ngx_http_not_modified_filter_module (static)