当前位置:网站首页>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
访问进行测试:
获取其他数据



边栏推荐
- Divisible property 1
- dsafasfdasfasf
- 2022-08-08 mysql慢SQL-Q18-10GB数据量-mysql/innodb测试
- 2022年8月深圳产品经理认证招生简章(NPDP)
- 2022下半年深圳信息系统项目管理师认证招生简章
- 【Harmony OS】【ARK UI】公共事件模块
- Base64编码和图片转化
- `数学` 极限, 渐进分析, 近似阶, 线性化, 线性近似, 线性函数
- 2022 Security Officer-A Certificate Special Work Permit Exam Question Bank and Online Mock Exam
- mysql内容不存在的报错
猜你喜欢
随机推荐
TCP/IP协议中分包与重组原理介绍、分片偏移量的计算方法、IPv4报文格式
稳定性测试怎么做,这篇文章彻底讲透了!
区别如下概念:助记符、汇编语言、汇编语言程序和汇编程序。
2022下半年深圳信息系统项目管理师认证招生简章
LN论文、五种归一化原理和实现
Quantitative Genetics Heritability Calculation 1: Parent-Child Regression Method
杰理之SD卡切回蓝牙没有作用【篇】
`数学` 极限, 渐进分析, 近似阶, 线性化, 线性近似, 线性函数
Introduction to JVM garbage collection mechanism
HP路由器和交换机日志分析
【开发者必看】【push kit】推送服务服务典型问题合集2
MySQL: Intent Shared Locks and Intentional Exclusive Locks | Deadlocks | Lock Optimization
2022-08-08 mysql慢SQL-Q18-10GB数据量-mysql/innodb测试
How to do the stability test, this article thoroughly explains it!
【日常训练--腾讯精选50】7. 整数反转
【学习笔记】AGC044
杰理之开关降噪语音识别没有用【篇】
什么是通用微处理器、单片机、DSP芯片、嵌入式系统?
【HMS core】【Ads Kit】华为广告——海外应用在国内测试正式广告无法展示
The influence law of genes for disease - read the paper

![[Harmony OS] [ARK UI] ETS context basic operations](/img/40/d5924477c42e2b3246eb212f4be534.png)







