编译nginx的时候报错 需要安装PCRE 您所在的位置:网站首页 nginx编译安装需要的库 编译nginx的时候报错 需要安装PCRE

编译nginx的时候报错 需要安装PCRE

2024-07-15 10:17| 来源: 网络整理| 查看: 265

 ./configure --prefix=/mynginx/

本地编译nginx的时候 报错 提示需要安装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

地址:http://www.pcre.org. 

解压到路经

/usr/local/src我下载安装的是pcre2-10.32.tar cd pcre2-10.32 ./configure --prefix=/usr/local 详细操作流程cd /usr/local/src tar pcre2-10.32.tarcd pcre2-10.32 ./configure --prefix=/usr/local make sudo make install

安装成功之后

重新回去编译nginx根据错误信息 需要增加参数 指定PCRE library的路经地址

./configure --prefix=/mynginx/  --with-pcre=/usr/local/

重新编译 成功.

 

修正:

1、

./configure --prefix=/mynginx/  --with-pcre=/usr/local/

其中参数制定的是pcre源码库的位置路经 不是设置的prefix

 

2、不可以用pcre2 用pcre2会报错

src/core/ngx_regex.h:15:10: fatal error: 'pcre.h' file not found#include ^~~~~~~~1 error generated.

 

最终的执行

 

 

./configure --prefix=/mynginx/ --with-pcre=/Users/qiaodan/pcre-8.42 --with-openssl=/Users/qiaodan/openssl-1.1.1a --with-http_ssl_module --with-http_v2_module

结果:

 

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有