avatar

自动编译安装带有lua功能的nginx(Tengine)服务器
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
yum install -y openssl-devel pcre-devel zlib-devel lua-devel lua-json openssl
DIR=`pwd`"/ngxin"
mkdir $DIR
cd $DIR
#--download
wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
git clone https://github.com/openresty/lua-cjson.git
git clone https://github.com/openresty/lua-resty-redis.git


tar zxvf tengine-2.3.2.tar.gz
tar zxvf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
make install PREFIX=/usr/local/luajit
if [ $? -ne 0 ]; then
echo "[Error!]Luajit Compile/install error!"
exit
fi
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0
ln -s /usr/local/luajit/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

cd ../tengine-2.3.2
./configure --add-module=./modules/ngx_http_upstream_check_module --add-module=./modules/ngx_http_lua_module
if [ $? -ne 0 ]; then
echo "[Error!]Nginx Configure error!"
exit
fi
make
if [ $? -ne 0 ]; then
echo "[Error!]Nginx Make error!"
exit
fi
make install
if [ $? -ne 0 ]; then
echo "[Error!]Nginx Install error!"
exit
else
echo "[Info!]Nginx Install success! \n"
fi