WAF本地測試環(huán)境搭建(tengine+lua)

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)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末摹蘑,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子轧飞,更是在濱河造成了極大的恐慌衅鹿,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,509評論 6 504
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件过咬,死亡現(xiàn)場離奇詭異大渤,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)掸绞,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,806評論 3 394
  • 文/潘曉璐 我一進(jìn)店門兼犯,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人集漾,你說我怎么就攤上這事切黔。” “怎么了具篇?”我有些...
    開封第一講書人閱讀 163,875評論 0 354
  • 文/不壞的土叔 我叫張陵纬霞,是天一觀的道長。 經(jīng)常有香客問我驱显,道長诗芜,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,441評論 1 293
  • 正文 為了忘掉前任埃疫,我火速辦了婚禮伏恐,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘栓霜。我一直安慰自己翠桦,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 67,488評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著销凑,像睡著了一般丛晌。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上斗幼,一...
    開封第一講書人閱讀 51,365評論 1 302
  • 那天澎蛛,我揣著相機(jī)與錄音,去河邊找鬼蜕窿。 笑死谋逻,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的桐经。 我是一名探鬼主播毁兆,決...
    沈念sama閱讀 40,190評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼次询!你這毒婦竟也來了荧恍?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,062評論 0 276
  • 序言:老撾萬榮一對情侶失蹤屯吊,失蹤者是張志新(化名)和其女友劉穎送巡,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體盒卸,經(jīng)...
    沈念sama閱讀 45,500評論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡骗爆,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,706評論 3 335
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了蔽介。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片摘投。...
    茶點故事閱讀 39,834評論 1 347
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖虹蓄,靈堂內(nèi)的尸體忽然破棺而出犀呼,到底是詐尸還是另有隱情,我是刑警寧澤薇组,帶...
    沈念sama閱讀 35,559評論 5 345
  • 正文 年R本政府宣布外臂,位于F島的核電站,受9級特大地震影響律胀,放射性物質(zhì)發(fā)生泄漏宋光。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,167評論 3 328
  • 文/蒙蒙 一炭菌、第九天 我趴在偏房一處隱蔽的房頂上張望罪佳。 院中可真熱鬧,春花似錦黑低、人聲如沸赘艳。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,779評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽第练。三九已至阔馋,卻和暖如春玛荞,著一層夾襖步出監(jiān)牢的瞬間娇掏,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,912評論 1 269
  • 我被黑心中介騙來泰國打工勋眯, 沒想到剛下飛機(jī)就差點兒被人妖公主榨干…… 1. 我叫王不留婴梧,地道東北人。 一個月前我還...
    沈念sama閱讀 47,958評論 2 370
  • 正文 我出身青樓客蹋,卻偏偏與公主長得像塞蹭,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子讶坯,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,779評論 2 354

推薦閱讀更多精彩內(nèi)容