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

相关推荐
古月的三个锦囊2 天前
Nginx openresty web服务 与 Go 原生web服务性能对比
nginx·go·openresty
Julian.zhou1 个月前
MCP服务:五分钟实现微服务治理革命,无缝整合Nacos/Zookeeper/OpenResty
人工智能·微服务·zookeeper·交互·openresty
PatrickYao04221 个月前
雨云云应用测评!内测持续进行中!
mysql·部署·网站搭建·openresty·rca
ZZDICT1 个月前
OpenResty(Lua)+Redis实现动态封禁IP
redis·nginx·lua·openresty
衣舞晨风1 个月前
Apache APISIX 架构浅析
架构·apache·openresty·apisix
衣舞晨风1 个月前
NGINX 执行阶段与OpenResty的 *_by_lua指令
nginx·lua·openresty·执行阶段
dgiij2 个月前
对免认证服务提供apikey验证
nginx·http·lua·llama·openresty
蕴微轩2 个月前
用openresty和lua实现壁纸投票功能
lua·openresty
xyc12112 个月前
OpenResty
openresty
蕴微轩3 个月前
通过openresty和lua实现随机壁纸
开发语言·lua·openresty