基于centos7源码编译openresty
概述#
基于源码构建openresty,为后续编写lua嵌入式脚本提供测试环境。OpenResty® 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。
环境:
centos7 x86_64
openresty-1.15.8.1.tar.gz
下载#
http://openresty.org/cn/download.html
https://openresty.org/download/openresty-1.15.8.1.tar.gz
http://openresty.org/cn/components.html ###lua给nginx扩展的lua插件,实现更多协议及应用的负载
依赖#
注意:openresty是基于ningx上嵌入lua的解释器支持插件的拓展
yum install -y gcc make pcre-devel openssl-devel zlib-devel
tar xf openresty-1.15.8.1.tar.gz
编译#
[root@c_3 openresty-1.15.8.2]# ./configure --prefix=/opt/openresty
[root@c_3 openresty-1.15.8.2]# make -s -j2
==== Building LuaJIT 2.1.0-beta3 ====
==== Successfully built LuaJIT 2.1.0-beta3 ====
[root@c_3 openresty-1.15.8.2]#
[root@c_3 openresty-1.15.8.2]# make -s install
==== Building LuaJIT 2.1.0-beta3 ====
==== Successfully built LuaJIT 2.1.0-beta3 ====
==== Installing LuaJIT 2.1.0-beta3 to /opt/openresty/luajit ====
==== Successfully installed LuaJIT 2.1.0-beta3 to /opt/openresty/luajit ====
测试#
[root@c_3 openresty]# ./bin/openresty -v
nginx version: openresty/1.15.8.2
[root@c_3 openresty]# ./bin/openresty -V ###默认编译自动编译的参数
nginx version: openresty/1.15.8.2
###nginx_lua.conf worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { server { listen 8080; location / { default_type text/html; content_by_lua_block { ngx.say("<p>hello, world</p>") } } } }
测试配置文件及启动服务
[root@c_3 openresty]# ./bin/openresty -c /opt/openresty/conf/nginx_lua.conf -t ###openresty软连接nginx/sbin/nginx nginx: the configuration file /opt/openresty/conf/nginx_lua.conf syntax is ok nginx: configuration file /opt/openresty/conf/nginx_lua.conf test is successful [root@c_3 openresty]# ./bin/openresty -c /opt/openresty/conf/nginx_lua.conf ###启动服务 [root@c_3 openresty]# ps -ef |grep nginx root 10398 1 0 04:28 ? 00:00:00 nginx: master process ./bin/openresty - nobody 10399 10398 0 04:28 ? 00:00:00 nginx: worker process root 10424 1 0 04:33 ? 00:00:00 nginx: master process ./bin/openresty -c /opt/openresty/conf/nginx_ lua.confnobody 10425 10424 0 04:33 ? 00:00:00 nginx: worker process root 10427 10362 0 04:33 pts/1 00:00:00 grep --color=auto nginx [root@c_3 openresty]# [root@c_3 openresty]# ss -lnt State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:8080 *:* LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::2375 :::* LISTEN 0 128 :::22 :::* [root@c_3 openresty]# curl 127.0.0.1:8080/ ###正常响应 <p>hello, world</p>
作者: mvpbang
出处:https://www.cnblogs.com/xiaochina/p/12340598.html
版权:本文采用「署名-非商业性使用-相同方式共享 4.0 国际」知识共享许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
2019-02-21 生产系统ELK日志采集系统
2018-02-21 Serv-U精简版FTP服务端
2017-02-21 软媒数据恢复
2017-02-21 Oracle的PLSQL别名中文出现乱码解决方法