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

相关推荐
rannn_11113 天前
【Redis|高级篇2】多级缓存|JVM进程缓存、Lua语法、多级缓存实现(OpenResty)、缓存同步(Canal)
java·redis·分布式·后端·缓存·lua·openresty
夜影风17 天前
Tengine、OpenResty与Nginx三大Web服务中间件对比分析
nginx·openresty·技术架构
難釋懷22 天前
OpenResty实现Redis查询
数据库·redis·openresty
難釋懷24 天前
OpenResty封装Redis工具
redis·junit·openresty
難釋懷1 个月前
OpenResty实现Tomcat查询
tomcat·firefox·openresty
難釋懷1 个月前
OpenResty基于ID负载均衡
junit·负载均衡·openresty
難釋懷1 个月前
OpenResty-CJSON工具类
junit·openresty
難釋懷1 个月前
OpenResty封装http工具
http·junit·openresty
he___H1 个月前
Nginx+lua+openresty
nginx·lua·openresty
難釋懷1 个月前
OpenResty查询Tomcat
tomcat·firefox·openresty