# openresty_demo **Repository Path**: molio/openresty_demo ## Basic Information - **Project Name**: openresty_demo - **Description**: openresty+lua的demo仓库 - **Primary Language**: Lua - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-06-15 - **Last Updated**: 2023-02-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpenResty开发demo 文章参考声明: - https://www.cnblogs.com/onblog/p/13044230.html - https://www.jianshu.com/p/dbe6bf7edfb4 ## 开发流程 以读写文件(获取当前时间写入文件后读出)为例 - 确保openresty安装成功(安装过程参考[OpenResty官网](https://openresty.org/cn/installation.html)) - 克隆openresty demo的仓库(可自行定义存放目录) ``` # 假设在/tmp目录下克隆 git clone https://gitee.com/molio/openresty-demo.git ``` - 编写lua文件 本demo中的lua文件`getfilecontent.lua`包含对文件的读写函数及调用 - 编写nginx.conf文件,引用lua文件(详见`nginx.conf`) - 启动openresty(可参考脚本`start.sh`) ``` /usr/bin/openresty -p /tmp/openresty-demo/ -c /tmp/openresty-demo/nginx.conf ``` - 停止openresty(可参考脚本`stop.sh`) ``` ps -aux | grep nginx | awk '{print $2}' | xargs kill -9 ``` luajit加密文件命令 ``` /usr/local/openresty/luajit/bin/luajit -b getfilecontent.lua cgetfilecontent.lua ``` ## Lua实现rsa加密 参考地址:https://github.com/LittleLiByte/lua-rsa.git