一、官网下载安装包 openresty nginx
二、本机安装 perl、openssl、libreadline、libpcre、libsslvim
yum install readline-devel pcre-devel openssl-devel perl -y
三、安装curl
tar xzvf ngx_openresty-VERSION.tar.gz cd ngx_openresty-VERSION/ ./configure make make install
三、测试运行测试
cd /usr/local/openresty/nginx/conf vim vim nginx.conf
编辑nginx.conflua
http { # 设置默认 lua 搜索路径,添加 lua 路径 lua_package_path 'lua/?.lua;/blah/?.lua;;'; location ~ ^/openresty/([-_a-zA-Z0-9/]+){ default_type text/plain; content_by_lua_file lua/add_$1.lua; } error_log logs/stat.error.log; }
编写lua脚本url
mkdir /usr/local/openresty/nginx/lua cd /usr/local/openresty/nginx/lua vim test.lua
test.luarest
ngx.say("测试成功")
curl http://127.0.0.1/openresty/test code
详细教程可参考openresty官网、OpenResty最佳实践教程
完毕,下面就能够跟据业务需求开发了ssl