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脚本

相关推荐
Volunteer Technology7 天前
openresty-lua-redis案例
redis·lua·openresty
i-阿松!13 天前
Django + Vue 项目部署(1panel + openresty)
vue.js·django·openresty
hzsnone15 天前
公网服务器上Nginx或者Openresty如何屏蔽IP直接扫描
服务器·nginx·openresty
hzsnone1 个月前
Openresty 支持HTTP/3协议和QUIC配置
网络协议·openresty
Narutolxy1 个月前
Nginx/OpenResty HTTP 请求处理阶段与 Lua 实践全解20250717
nginx·http·openresty
伊成2 个月前
保姆级安装OpenResty教程
openresty
Clownseven3 个月前
Nginx Lua模块(OpenResty)实战:动态化、智能化你的Nginx,实现复杂Web逻辑 (2025)
nginx·lua·openresty
龙哥·三年风水3 个月前
openresty+lua+redis把非正常访问的域名加入黑名单
redis·lua·openresty
大得3693 个月前
安装openresty使用nginx+lua,openresty使用jwt解密
nginx·lua·openresty
莱茵不哈哈3 个月前
OpenResty 深度解析:构建高性能 Web 服务的终极方案
nginx·lua·kong·openresty·conf