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

相关推荐
翰林小院1 天前
【云原生监控】 Grafana/Prometheus/Promtail/Loki/Tempo
openresty
白驹过隙不负青春2 天前
OpenResty 1.29.2.5 部署 + Nginx平滑升级运维文档
nginx·openresty
Cry丶2 天前
一次 FTP 上传引发 504 Gateway Timeout 的排查复盘
java·nginx·ftp·openresty·被动模式·504 gateway·生产问题排查
吴懿不在8 天前
apisix~OpenResty各阶段的介绍
openresty
章老师说11 天前
NGINX官方谈Lua风险:这其实是两条网关技术路线之争
运维·nginx·负载均衡·lua·openresty
装不满的克莱因瓶1 个月前
基于 OpenResty 扩展开发实现动态服务注册与发现能力
java·开发语言·架构·openresty
wu8587734571 个月前
OpenResty 源站被扫描的排查与防御实战:Cloudflare + DOCKER-USER + Fail2Ban 最全方案解析
docker·容器·openresty
章老师说1 个月前
B站网关事故背后:OpenResty 与 Lua 的稳定性代价
nginx·云原生·负载均衡·lua·openresty
衣舞晨风2 个月前
运行时行为盲区:API7 AI 网关CPU打满故障的AI辅助事后复盘
lua·openresty·apisix·coroutine·cpu-saturation·socket-buffer
rannn_1113 个月前
【Redis|高级篇2】多级缓存|JVM进程缓存、Lua语法、多级缓存实现(OpenResty)、缓存同步(Canal)
java·redis·分布式·后端·缓存·lua·openresty