还可以直接使用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 openresty
6、访问http://127.0.0.1显示如下信息
Hello Openresty
7、限流原理是一样的,可以直接写lua脚本。
网友回复
腾讯混元模型广场里都是混元模型的垂直小模型,如何api调用?
为啥所有的照片分辨率提升工具都会修改照片上的图案细节?
js如何在浏览器中将webm视频的声音分离为单独音频?
微信小程序如何播放第三方域名url的mp4视频?
ai多模态大模型能实时识别视频中的手语为文字吗?
如何远程调试别人的chrome浏览器获取调试信息?
为啥js打开新网页window.open设置窗口宽高无效?
浏览器中js的navigator.mediaDevices.getDisplayMedia屏幕录像无法录制SpeechSynthesisUtterance产生的说话声音?
js中mediaRecorder如何录制window.speechSynthesis声音音频并下载?
python如何直接获取抖音短视频的音频文件url?