openResty安装运行

安装和运行

1
2
3

docker run -d --name openresty -p 80:80 -v /root/data/openresty/config/conf.d:/etc/nginx/conf.d -v /root/data/openresty/data:/data openresty/openresty

安装插件

安装 wget 软件
apt update
apt install -y wget

/usr/local/openresty 目录下下载需要的lua组件

/etc/nginx/conf.d 配置

lua_package_path “/usr/local/openresty/lualib/?.lua;;”;
lua_package_cpath “/usr/local/openresty/lualib/?.so;;”;

#不需要

#include /etc/nginx/conf.d/lua.conf

配置lua代码

server {
listen 80;
server_name _;
location /lua {
default_type ‘text/html’;
content_by_lua_file /etc/nginx/conf.d/conf/lua/test.lua;
}
}

配置openresty -nginx 核心代码

/usr/local/openresty/nginx