openresty安装文档

一、OpenResty简介
    OpenResty是一个基于 Nginx与 Lua的高性能 Web平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。
用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。
二、Lua简介
    Lua是一个简洁、轻量、可扩展的程序设计语言,其设计目的是为了嵌入应用程序中,从而为应用程序提供灵活的扩展和定制功能。
Lua由标准C编写而成,代码简洁优美,几乎在所有操作系统和平台上都可以编译,运行。
三、OpenResty安装
1、安装依赖库
yum -y install readline-devel pcre-devel openssl-devel gcc
2、安装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能正常输出。

3、配置waf

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";
原文地址:https://www.cnblogs.com/fansik/p/7068425.html