还可以直接使用openresty的内置lua模块
openresty是什么
openresty也是web服务器,是基于nginx开发出来,但其内置了lua扩展功能,能让你编写lua脚本对其进行扩展。
安装openresty
我们下面只说centos下的安装方法,其它平台安装方法请参照官网文档:
https://openresty.org/en/installation.html添加软件仓库源
wget https://openresty.org/package/centos/openresty.repo -O /etc/yum.repos.d/openresty.repo
安装软件
yum install openresty
3、打开配置文件
vim /usr/local/openresty/nginx/conf/nginx.conf
4、修改配置文件内容如下
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
default_type text/html;
content_by_lua_block {
ngx.say("<h1>Hello Openresty</h1>")
}
}
}
}5、启动openrestysystemctl restart openresty6、访问http://127.0.0.1显示如下信息
Hello Openresty
7、限流原理是一样的,可以直接写lua脚本。
网友回复
fbx、obj、glb三维格式模型如何在浏览器中通过three相互转换格式?
python如何实现基于http隧道加密的正向代理服务?
有没有有专门针对 UI 界面截图进行智能标记(Set-of-Mark, SoM) 的开源库和工具?
如何用python实现Set-of-Mark (SoM) 技术?
python如何截取windows指定应用的窗口截图,不用管窗口是不是在最前面?
linux能不能给rm删除命令增加回收站功能,可恢复被删文件?
bfwsoa如何在命令行中执行控制器动作器方法?
RAG(检索增强生成)和 KG(知识图谱)有啥不同?
KVM硬件是啥?
ai大模型对于大型项目源码上下文不够是如何解决进行开发与修改功能的?


