安装脚本如下:
#!/bin/bash
#
#
# 安装tengine带lua和echo模块
#
# Install LuaJIT.
cd /usr/local && \
wget http://luajit.org/download/LuaJIT-2.0.3.tar.gz && \
tar xvzf LuaJIT-2.0.3.tar.gz && \
cd LuaJIT-2.0.3 && \
make && \
make install && \
cd .. && \
rm -rf LuaJIT-2.0.3.tar.gz
echo "/usr/local/lib" >> /etc/ld.so.conf
# Download lua-nginx-module.
cd /usr/local/src && \
wget http://github.com/openresty/lua-nginx-module/archive/v0.9.10.tar.gz && \
mv v0.9.10 v0.9.10.tar.gz && \
tar xvzf v0.9.10.tar.gz && \
rm -rf v0.9.10.tar.gz
# Download pcre.
cd /usr/local && \
wget http://exim.mirror.fr/pcre/pcre-8.35.tar.gz && \
tar -xvzf pcre-8.35.tar.gz && \
cd pcre-8.35 && \
./configure && \
make && \
make install && \
cd .. && \
rm -rf pcre-8.35.tar.gz
# Install ssl
cd /usr/local/src && \
wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz && \
tar xvzf openssl-1.0.1h.tar.gz && \
rm -rf openssl-1.0.1h.tar.gz
# Install zlib
cd /usr/local/src && \
wget http://www.zlib.net/zlib-1.2.11.tar.gz && \
tar xvzf zlib-1.2.11.tar.gz && \
rm -rf zlib-1.2.8.tar.gz
# Install perl
yum -y install perl
# install echo-nginx-module
cd /usr/local/src && \
wget http://github.com/openresty/echo-nginx-module/archive/v0.60.tar.gz && \
mv v0.60 v0.60.tar.gz && \
tar xvzf v0.60.tar.gz && \
rm -rf v0.60.tar.gz
# Install tengine.
cd /usr/local && \
wget http://tengine.taobao.org/download/tengine-2.0.3.tar.gz && \
tar xvzf tengine-2.0.3.tar.gz && \
cd tengine-2.0.3 && \
export LUAJIT_LIB=/usr/local/lib && \
export LUAJIT_INC=/usr/local/include/luajit-2.0 && \
./configure --prefix=/usr/local/nginx \
--with-openssl=/usr/local/src/openssl-1.0.1h \
--with-zlib=/usr/local/src/zlib-1.2.11 \
--add-module=/usr/local/src/lua-nginx-module-0.9.10 \
--add-module=/usr/local/src/echo-nginx-module-0.60 && \
make && \
make install && \
cd .. && \
rm -rf tengine-2.0.3.tar.gz
启动nginx报错
# 测试nginx参数是否正常
/usr/local/nginx/sbin/nginx -t
报错如下: /usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
# 解决办法
# 在 /lib目录或/lib64目录下,找到libpcre.so.0.0.1,链接到libpcre.so.1上
ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
# 再次启动nginx
/usr/local/nginx/sbin/nginx