参考官网: https://openresty.org/en/
安装环境:本地mac
- 下载源码并解压
curl -O https://openresty.org/download/openresty-1.19.9.1.tar.gz
- 下载编译依赖模块
// 依赖pcre和openssl模块,本地已经存在则忽略
curl -O https://ftp.pcre.org/pub/pcre/pcre-8.45.tar.gz
curl -O https://github.com/openssl/openssl/tree/openssl-3.0.0
- 编辑安装
- –prefix 指定安装路径
- –with-pcre 指定依赖pcre模块源码路径
- –with-openssl 指定依赖openssl模块源码路径
- 使用 ./configure --help 查看更多的选项
./configure --prefix=/Users/xxx/java/openresty --with-pcre=/Users/xxx/java/libs/pcre-8.45 --with-openssl=/Users/xxx/java/libs/openssl-openssl-3.0.0
make
make install
- 安装校验
# 查看编译信息
/Users/xxx/java/openresty/nginx -V
# 查看配置文件
/Users/xxx/java/openresty/nginx -t
# 启动
/Users/xxx/java/openresty/nginx
# 停止
/Users/xxx/java/openresty/nginx -s stop