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 > 平滑升级:1.25.x → 1.27.x
junit·openresty
huangdengji19 天前
基于openresty反向代理、dns劫持、实现对http请求、响应内容抓包
网络协议·http·openresty
IT小哥哥呀20 天前
Nginx高可用配置实战:负载均衡 + 健康检查 + 动态扩展
运维·nginx·负载均衡·devops·日志分析·openresty·动态扩展
❀͜͡傀儡师1 个月前
OpenResty + Lua + Redis 鉴权案例,适用于 x86 和 ARM 架构的 Docker 环境。
redis·lua·openresty
Narutolxy1 个月前
从混合部署到高可用:在内网环境下搭建 GitLab-Jenkins-OpenResty的完整实战复盘20251014
gitlab·jenkins·openresty
小白银子2 个月前
零基础从头教学Linux(Day 45)
linux·运维·junit·openresty
java搬砖工-苤-初心不变2 个月前
OpenResty 限流方案对比:lua_shared_dict vs Redis
redis·lua·openresty
java搬砖工-苤-初心不变2 个月前
OpenResty 配合 Lua 脚本的使用
开发语言·lua·openresty
观测云3 个月前
Openresty Tracing 最佳实践
openresty
我发在否3 个月前
Lua > OpenResty HelloWorld
lua·openresty