下载
- 打开url:https://openresty.org/cn/download.html
- 找到最新版本或者合适的版本
curl https://openresty.org/download/openresty-${version}.tar.gz tar -zxvf openresty-${version}.tar.gz cd openresty-${version}
|
编译、安装
- 安装前的准备:安装基础库
yum install -y pcre-devel openssl-devel gcc curl
|
./configure
1 2 3 4 5 6
| ./configure --prefix=/opt/openresty \ --with-luajit \ --with-http_iconv_module \ --with-http_postgres_module
|
- 安装
使用
- 启动nginx
cd openresty-${version}/nginx/sbin ./nginx
|
- 重新加载nginx配置
- 停止nginx
- 重启nginx
Q&A
- 执行
./configure
时,可能会出现以下错误
- 错误:
./configure: error: ngx_postgres addon was unable to detect version of the libpq library.
- 解决:
yum install -y postgresql-devel