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

相关推荐
程序那点事儿4 天前
open-resty 服务安装kafka插件
linux·分布式·nginx·kafka·lua·运维开发·openresty
爱编码的钓鱼佬22 天前
浅谈openresty
运维·nginx·openresty
shall_zhao22 天前
安装OpenResty(Linux-Docker)
linux·docker·openresty
shall_zhao25 天前
黑马点评18——多级缓存-OpenResty
redis·缓存·lua·openresty
代码是谁25 天前
centos8构建nginx1.27.1+BoringSSL+http3+lua+openresty
nginx·lua·http3·openresty
刘大帅ps2 个月前
高性能 Web 服务器:让网页瞬间绽放的魔法引擎(下)
linux·运维·服务器·网络·nginx·负载均衡·openresty
ciqingloveless2 个月前
openresty整合modsecurity实现简单的防止DDOS攻击
ddos·openresty
Roc-xb2 个月前
Docker安装 OpenResty详细教程
docker·容器·openresty
秃了也弱了。3 个月前
OpenResty使用Lua笔记
lua·openresty
路多辛3 个月前
OpenResty程序如何连接开启了TLS的Redis?
数据库·redis·openresty