openresty安装文档

1、OpenResty简介
    OpenResty是一个基于 Nginx与 Lua的高性能 Web平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。
用于方便地搭建可以处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。
2、Lua简介
    Lua是一个简洁、轻量、可扩展的程序设计语言,其设计目的是为了嵌入应用程序中,从而为应用程序提供灵活的扩展和定制功能。
Lua由标准C编写而成,代码简洁优美,几乎在全部操做系统和平台上均可以编译,运行。
3、OpenResty安装
一、安装依赖库
yum -y install readline-devel pcre-devel openssl-devel gcc
二、安装OpenResty
tar xf openresty-1.11.2.3.tar.gz
cd openresty-1.11.2.3
./configure --prefix=/usr/local/openresty --with-luajit --with-http_iconv_module --with-pcre --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_flv_module --with-http_realip_module
gmake
gmake install

ln -s /usr/local/openresty/bin/resty /usr/bin/resty
启动nginx服务这里要注意的是nginx必定要是openresty中的nginx的服务,不然会提示lua的配置参数没法识别,
能够执行这个命令:ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
若是/usr/sbin目录下存在nginx,能够先将改文件移到其余位置
在OpenResty安装好后须要将nginx和resty命令配置到环境变量中, 使用nginx -v和resty -v能正常输出。nginx

三、配置wafgit

 

git clone https://github.com/unixhot/waf.git
cp waf/* /usr/local/openresty/nginx/conf
编辑nginx.conf在http中添加以下内容:
lua_shared_dict limit 50m;
lua_package_path "/usr/local/openresty/nginx/conf/waf/?.lua";
init_by_lua_file "/usr/local/openresty/nginx/conf/waf/init.lua";
access_by_lua_file "/usr/local/openresty/nginx/conf/waf/access.lua";
相关文章
相关标签/搜索