由于是内网的原因,不能直接使用yum install -y直接安装,一些安装包都需要自己手动安装,现记录如下。以下报错是在安装过程中,依次报错信息,然后一步一步进行解决。
执行
./configure --prefix=/usr/local/openresty
- pcre报错信息
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=option. - 安装pcre:
wget https://netix.dl.sourceforge.net/project/pcre/pcre/8.40/pcre-8.40.tar.gz
tar -zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure --prefix=/usr/local/pcre
make
make install
再执行
./configure --prefix=/usr/local/openresty --with-pcre=/usr/local/pcre
- openssl报错信息
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=
- 安装openssl
提前使用 whereis zlib 检查是否已安装zlib库
wget ftp://ftp.openssl.org/source/openssl-1.1.1l.tar.gz
tar -zxvf openssl-1.1.1l.tar.gz
cd openssl-1.1.1l
./config --prefix=/usr/local/openssl
make
make install
再执行
./configure --prefix=/usr/local/openresty --with-pcre=/usr/local/pcre --with-openssl=/usr/local/openssl
此次configure成功,提示信息有:
Configuration summary
++ using PCRE library: /usr/local/pcre
++ using OpenSSL library: /usr/local/openssl
++ using system zlib library
但是仍然报错:
检查后发现:
./configure --help | grep ‘–with-pcre’
–with-pcre force PCRE library usage
–with-pcre=DIR set path to PCRE library sources
–with-pcre-opt=OPTIONS set additional build options for PCRE
–with-pcre-jit build PCRE with JIT compilation support
也就是–with-pcre是存放源码的路径
解压缩保存一份pcre源码,重新执行:
./configure --prefix=/usr/local/openresty --with-pcre=/usr/local/pcre_src/pcre-8.40 --with-openssl=/usr/local/openssl
此次configure成功,提示信息有:
Configuration summary
++ using PCRE library: /usr/local/pcre_src/pcre-8.40
++ using OpenSSL library: /usr/local/openssl
++ using system zlib library
同理openssl也会报这样的错,–with-openssl也是指向openssl的源码路径,调整后执行:
./configure --prefix=/usr/local/openresty --with-pcre=/usr/local/pcre_src/pcre-8.40 --with-openssl=/usr/local/openssl_src/openssl-1.1.1l
执行成功后,执行
gmake && gmake install
测试openresty
启动openresty
sudo /usr/local/openresty/bin/openresty -p `pwd`/ -c /usr/local/openresty/nginx/conf/nginx.conf
本文详细记录了在内网环境下,由于无法直接使用yum安装openresty,如何手动下载pcre和openssl源码,配置并解决依赖问题,最终成功安装openresty的过程。

829

被折叠的 条评论
为什么被折叠?



