System environment
# Uname-r
3.10.0-229.el7.x86_64
# Cat/etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
Required Modules
Pcre ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
Luajit http://luajit.org/download.html
Ngx_devel_kit Https://github.com/simpl/ngx_devel_kit/tags
Lua_nginx_module Https://github.com/openresty/lua-nginx-module/tags
Installation steps
1 , installation Luajit
1.1 Installation
# cd/tools/
# wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz
# Tar XF luajit-2.0.4.tar.gz
# CD LuaJIT-2.0.4
# make
# Make Install Prefix=/application/luagit
# CD
1.2 Configure Luagit
# Export luajit_lib=/application/luagit/lib/
# Export luajit_inc=/application/luagit/include/luajit-2.0/
2 , installation Ngx_devel_kit
# cd/tools/
# wget https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz
# Tar XF ngx_devel_kit-0.2.19.tar.gz
# MV Ngx_devel_kit-0.2.19/application/ngx_devel_kit
# CD
3 , installation Lua_nginx_module
# cd/tools/
# wget https://github.com/openresty/lua-nginx-module/archive/v0.10.0.tar.gz
# Tar XF lua-nginx-module-0.10.0.tar.gz
# MV Lua-nginx-module-0.10.0/application/lua-nginx-module
# CD
4 , installation Nginx
Install the base environment
# yum install-y pcre Pcre-developenssl openssl-devel
Create users and Groups
# Groupadd Nginx
# useradd Nginx-g nginx-m-s/sbin/nologin
Download the decompression Nginx
# cd/tools/
# wget http://nginx.org/download/nginx-1.9.4.tar.gz
# Tar XF nginx-1.9.4.tar.gz
# CD nginx-1.9.4
# #./configure--user=nginx--group=nginx--prefix=/application/nginx-1.9.4--with-http_ssl_module--with-http_stub_ Status_module--with-pcre--add-module=/application/ngx_devel_kit--add-module=/application/lua-nginx-module
# MAKE-J2
# make Install
# ln-s/application/nginx-1.9.4//application/nginx
# CD
Check
#/application/nginx/sbin/nginx-v
/application/nginx/sbin/nginx:error while loading shared libraries:libluajit-5.1.so.2:cannot open Sharedobject file: No such file or directory
Solutions
# ln-s/application/luagit/lib/libluajit-5.1.so.2/lib64/
#/application/nginx/sbin/nginx-v
Nginx version:nginx/1.9.4
5 , configuration nginx.conf
Add the following lines to the server module
Location/kevin {
Default_type ' Text/plain ';
Content_by_lua ' Ngx.say ("hello,kevin! Iam lua. ") ';
}
6. Check and start Nginx
# .. /sbin/nginx-t
Nginx:the configuration file/application/nginx-1.9.4/conf/nginx.conf syntax is OK
Nginx:configuration file/application/nginx-1.9.4/conf/nginx.conf Test is successful
# .. /sbin/nginx
7. Testing the LUA Environment
enter in the browser Http://<serverip>/kevin That appears to be successful
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7A/73/wKioL1apqgGCwYFTAAAVhQh6q2Y600.png "title=" 1.png " alt= "Wkiol1apqggcwyftaaavhqh6q2y600.png"/>
This article is from the "Chang Jie listen to the Wind People" blog, please make sure to keep this source http://kevinhao.blog.51cto.com/5204735/1739503
Nginx Deployment LUA Environment