centos7安装nginx的https模块时遇到的问题
./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=<path> option.

  执行命令:yum -y install pcre-devel

 

./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=<path> option.

  执行命令:yum -y install openssl openssl-devel

如果使用 yum -y install openssl openssl-devel后还是出现上面的错误信息

上方所提示使用--with-openssl=来指定openssl的路径,但是其实这里需要指定的是源码包路径,不是openssl的安装位置

可以自行通过该地址https://www.openssl.org/source/openssl-1.1.1d.tar.gz去下载对应的openssl源码包,自行替换相应的openssl版本即可

然后将该包上传至服务器解压,编译nginx时指向该路径即可,比如这里我将下载的包上次到home目录里面并解压

./configure --with-http_ssl_module --with-openssl=/home/openssl-1.1.1d

 

最后在执行:

./configure --prefix=/usr/local/nginx  --with-http_ssl_module

 

然后输入命令 tar -zxvf nginx-1.21.5.tar.gz 命令将其解压
输入命令 mkdir -p /usr/local/nginx 创建nginx的安装目录
输入 cd nginx-1.21.5/ 进入nginx的解压目录
然后运行./configure --prefix=/usr/local/nginx  --with-http_ssl_module命令
然后分别运行
make
make install
nginx启动命令/usr/local/nginx/sbin/nginx
nginx停止命令/usr/local/nginx/sbin/nginx -s stop

  

posted on 2023-02-28 11:00  james-roger  阅读(486)  评论(0编辑  收藏  举报