安装OpenResty

OpenResty

OpenResty® 是一个基于 Nginx的高性能 Web 平台,用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。具备下列特点:

  • 具备Nginx的完整功能

  • 基于Lua语言进行扩展,集成了大量精良的 Lua 库、第三方模块

  • 允许使用Lua自定义业务逻辑自定义库

官方网站:OpenResty® - 开源官方站

1.安装开发库

安装OpenResty的依赖开发库,执行命令:

yum install -y pcre-devel openssl-devel gcc --skip-broken
2.安装OpenResty仓库

你可以在你的 CentOS 系统中添加 openresty`仓库,这样就可以便于未来安装或更新我们的软件包(通过yum check-update命令)。运行下面的命令就可以添加我们的仓库:

yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

如果提示说命令不存在,则运行:

yum install -y yum-utils 

然后再重复上面的命令。

3.安装OpenResty
yum install -y openresty
4.安装opm工具

opm是OpenResty的一个管理工具,可以帮助我们安装一个第三方的Lua模块。

如果你想安装命令行工具 opm,那么可以像下面这样安装 openresty-opm 包:

yum install -y openresty-opm
5.目录结构
6.配置nginx的环境变量

打开配置文件:

vi /etc/profile

在最下面加入两行:

export NGINX_HOME=/usr/local/openresty/nginx # NGINX_HOME:后面是OpenResty安装目录下的nginx的目录
export PATH=${NGINX_HOME}/sbin:$PATH

让配置生效:

source /etc/profile
相关推荐
蕴微轩3 天前
用openresty和lua实现壁纸投票功能
lua·openresty
xyc12113 天前
OpenResty
openresty
蕴微轩11 天前
通过openresty和lua实现随机壁纸
开发语言·lua·openresty
fly-iot11 天前
【openresty服务器】:源码编译openresty支持ssl,增加service系统服务,开机启动,自己本地签名证书,配置https访问
服务器·ssl·openresty
core51213 天前
“可通过HTTP获取远端WWW服务信息”漏洞修复
nginx·漏洞·openresty·可通过http·获取远端www服务信息
Narutolxy1 个月前
使用 OpenResty 构建高效的动态图片水印代理服务20250127
junit·openresty
龙哥·三年风水1 个月前
openresty(nginx)+lua+kafka实现日志搜集系统
kafka·lua·openresty
請叫我菜鳥1 个月前
什么是 OpenResty
nginx·lua·openresty
Hello.Reader1 个月前
深入浅出 OpenResty
junit·openresty
山人在山上2 个月前
nginx(openresty) lua 解决对接其他平台,响应文件中地址跨域问题
nginx·lua·openresty