1)安裝c++編譯器nginx
yum insatll gcc-c++c++
2)安裝必要組件api
yum install openssl-devel工具
yum install pcre-devellua
yum install readline-devel插件
3)編譯安裝rest
wget http://openresty.org/download/ngx_openresty-1.9.7.4.tar.gzcode
tar -zxvf ngx_openresty-1.9.7.4.tar.gzssl
cd ngx_openresty-1.9.7.4get
gmake clean
./configure --with-luajit --with-pcre-jit --with-pcre=../pcre-8.38
gmake
gmake install
4)使用方法:
默認安裝到/usr/local/openresty
也可指定安裝到--prefix=/opt/openresty
該目錄下存在4個文件夾,包括luajit,nginx,lualib,bin
5)安裝lua的管理工具 luarocks
wget http://luarocks.org/releases/luarocks-2.0.13.tar.gz tar -xzvf luarocks-2.0.13.tar.gz cd luarocks-2.0.13/ ./configure --prefix=/usr/local/openresty/luajit \ --with-lua=/usr/local/openresty/luajit/ \ --lua-suffix=jit-2.1.0-alpha \ --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 make sudo make install
6)安裝murmurhash3插件
/usr/local/openresty/luajit/bin/luarocks install murmurhash3
7)下載安裝擴展包
/usr/local/openresty/luajit/bin/luarocks install lapis
8)建立鏈接:
ln -s /usr/local/openresty-1.9.7.2/luajit/lib/lua/5.1/murmurhash3.so /usr/lib64/lua/5.1/murmurhash3.so