openresty安装

本文介绍了如何安装OpenResty,包括下载最新安装包,配置依赖,解压编译,以及设置环境变量的详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、下载安装

1、安装依赖

$ yum install readline-devel pcre pcre-devel openssl openssl-devel gcc curl GeoIP-devel

2、下载源码包

https://github.com/openresty/openresty/releases

选择最新安装包,下载解压

$ tar -zxvf openresty-1.19.3.1rc1.tar.gz 
$ cd openresty-1.19.3.1rc1/

confgure

$ ./configure --with-luajit --with-pcre --with-http_gzip_static_module --with-http_realip_module --with-http_geoip_module --with-http_ssl_module --with-http_stub_status_module
# --with-http_gzip_static_module 静态文件压缩
# --with-http_stub_status_module 监控nginx状态
# --with-http_realip_module 通过这个模块允许我们改变客户端请求头中客户端ip地址值(例如X-Real-IP 或 X-Forwarded-For),意义在于能够使得后台服务器记录原始客户端IP地址
# --with-pcre 设置PCRE库(pcre pcre-devel)
# --with-http_ssl_module 使用https协议模块 (openssl openssl-devel)
# --with-http_geoip_module 增加了根据ip获得城市信息,经纬度等模块(GeoIP-devel)

编译安装

$ make && make install

安装好之后,默认安装路径是/usr/local/openresty/, 可以通过下面的命令查看安装路径,及./confgure后面跟的参数,

$ ./confgure --help

二、设置环境变量

/etc/profile中添加配置

$ vim /etc/profile

# 在文件添加如下的内容
# export NGINX_HOME=/usr/local/openresty/nginx
# export PATH=$PATH:$NGINX_HOME/sbin

生效

$ source /etc/profile

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值