当前位置:网站首页>Openresty执行lua脚本
Openresty执行lua脚本
2022-08-09 04:53:00 【魔人Majin Buu】
Openresty可以执行lua代码或者lua脚本文件
在配置文件中进行配置
vi /usr/local/openresty/nginx/conf/nginx.conf
执行lua代码
location /lua {
default_type text/html;
content_by_lua ' ngx.say("<p>Hello, World!</p>") ';
}
1,default_type text/html; (指定输出的格式)
2,content_by_lua是openresty认识的命令,必须严格按照样式书写
执行lua脚本文件
创建一个用于存放lua脚本文件的目录,比如lua_file
2,编写一个lua脚本文件用于测试
ngx.say("<h1>excute lua file successfully~~~~~~~</h1>");
3,修改nginx.conf配置文件
location /lua_file {
default_type text/html;
content_by_lua_file lua_file/test.lua;
}
4,访问进行测试http://192.168.200.203/lua_file
通过lua获取请求参数中的第一个
nginx.conf配置文件
lua脚本文件
ngx.say(ngx.var.arg_a);
重新加载openresty服务
systemctl reload openresty.service
访问进行测试:
获取其他数据
边栏推荐
- 2022年8月深圳产品经理认证招生简章(NPDP)
- 亚马逊面对风控,自养号测评时应该怎么做?
- 浙江DAMA-CDGA/CDGP数据治理认证招生简章
- 【Harmony OS】【ARK UI】Date Basic Operation
- Cluster deployment using ceph-deploycep with 3 disks as dedicated osd
- Alibaba Cloud Tianchi Contest Question (Machine Learning) - Repeat Purchase Prediction of Tmall Users (Complete Code)
- 【HMS core】【Ads Kit】华为广告——海外应用在国内测试正式广告无法展示
- Introduction to JVM garbage collection mechanism
- 2022-08-07 反思
- 【Harmony OS】【ARK UI】轻量级数据存储
猜你喜欢
杰理之采用mix out eq 没有作用【篇】
Ali YunTianChi competition problem (machine learning) - O2O coupons prediction (complete code)
Cluster deployment using ceph-deploycep with 3 disks as dedicated osd
关于sys.path.append(‘..‘)失效
2022 High Voltage Electrician Exam Questions and Answers
Alibaba Cloud Tianchi Contest Question (Machine Learning) - Repeat Purchase Prediction of Tmall Users (Complete Code)
EDI对接 New York & Company案例
HP路由器和交换机日志分析
数字化时代,企业为什么需要商业智能BI
杰理之开关降噪语音识别没有用【篇】
随机推荐
【UNR #6 A】面基之路(最短路)
浙江DAMA-CDGA/CDGP数据治理认证招生简章
如何剪裁svg并压缩
单元测试覆盖率怎么算?
时序约束基础
Correct use of BaseDexClassLoader
杰理之播放最大音量提示音播不出来【篇】
Masked AutoEncoder论文及实现
JS-全局dom对象的使用---使用htm样式和js函数动作的完全分离
php使用phpoffice/phpspreadsheet导入导出excel表格
抖音直播新号怎么起号?抖音直播间不进人怎么办?
必须指定GDAL API版本。提供一个路径使用GDAL_CONFIG gdal-config环境
A case of missing heritability
perl基础语法归纳
杰理之电话打入,远端听不到声音【篇】
【HMS Core】【FAQ】【AR Engine】AR Engine FAQ
How to trim svg and compress
leetcode:316. 去除重复字母
[MLT] Analysis of MLT Multimedia Framework Production and Consumption Architecture (2)
pr22.5最新版下载地址