#下载LuaJIT
wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz

#下载ngx_devel_kit
wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.0.tar.gz -O ngx_devel_kit-0.3.0.tar.gz

#下载lua-nginx-module
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.13.tar.gz -O lua-nginx-module-0.10.13.tar.gz

tar -xzf LuaJIT-2.0.5.tar.gz tar -xzf ngx_devel_kit-0.3.0.tar.gz tar -xzf lua-nginx-module-0.10.13.tar.gz \
tar -xzf nginx-1.14.0.tar.gz tar -xzf openssl-1.1.1a.tar.gz

cd LuaJIT-2.0.5 
make && make install

vi /etc/profile
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0
source /etc/profile

echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig

cd nginx-1.14.0 && ./configure --prefix=/usr/local/nginx --user=nobody --group=nobody --with-ld-opt=-Wl,-rpath,/usr/local/include/luajit-2.0  --with-http_ssl_module --with-http_stub_status_module --with-http_v2_module --with-stream --with-http_sub_module --with-openssl=/root/tools/openssl-1.1.1a --add-module=/root/tools/lua-nginx-module-0.10.13 --add-module=/root/tools/ngx_devel_kit-0.3.0

#测试lua配置
server {
	listen 80;
	server_name  _;
	
	location /hello { 
		default_type 'text/plain'; 
		content_by_lua 'ngx.say("hello, lua")'; 
	  #content_by_lua_file conf/lua/hello.lua;
	}
}