openresty安装配置,执行shell脚本

  1. 下载并解压 OpenResty 源代码:

    复制代码

    bashCopy code

    wget https://openresty.org/download/openresty-1.19.9.1.tar.gz tar -zxvf openresty-1.19.9.1.tar.gz cd openresty-1.19.9.1

  2. 运行 ./configure 并指定安装路径:

    复制代码

    bashCopy code

    ./configure --prefix=/usr/app/openresty

  3. 编译并安装:

    复制代码

    bashCopy code

    make sudo make install

  4. 验证安装:

    复制代码

    bashCopy code

    /usr/app/openresty/nginx/sbin/nginx -v

  5. 启动 OpenResty:

    复制代码

    bashCopy code

    /usr/app/openresty/nginx/sbin/nginx

请根据实际需要调整路径和权限。确保在使用 make install 时有足够的权限来写入目标目录。

创建一个ftpfile.lua脚本

复制代码

-- 执行压缩文件存入数据库脚本

--io.stdout:setvbuf("no")

--io.stdout:setmode("noconvert")

ngx.say("Executing Lua script!")

--os.execute("export PATH=$PATH:/usr/bin")

os.execute("/usr/app/openresty/lua/ftpfile.sh")

保存。配置nginx .

复制代码

location /ftpfile {

default_type 'text/plain';

content_by_lua_file /usr/app/openresty/lua/ftpfile.lua;

}

启动浏览器访问。就执行lua脚本

相关推荐
蕴微轩3 天前
用openresty和lua实现壁纸投票功能
lua·openresty
xyc12113 天前
OpenResty
openresty
蕴微轩11 天前
通过openresty和lua实现随机壁纸
开发语言·lua·openresty
fly-iot12 天前
【openresty服务器】:源码编译openresty支持ssl,增加service系统服务,开机启动,自己本地签名证书,配置https访问
服务器·ssl·openresty
core51213 天前
“可通过HTTP获取远端WWW服务信息”漏洞修复
nginx·漏洞·openresty·可通过http·获取远端www服务信息
Narutolxy1 个月前
使用 OpenResty 构建高效的动态图片水印代理服务20250127
junit·openresty
龙哥·三年风水1 个月前
openresty(nginx)+lua+kafka实现日志搜集系统
kafka·lua·openresty
請叫我菜鳥1 个月前
什么是 OpenResty
nginx·lua·openresty
Hello.Reader1 个月前
深入浅出 OpenResty
junit·openresty
山人在山上2 个月前
nginx(openresty) lua 解决对接其他平台,响应文件中地址跨域问题
nginx·lua·openresty