編譯nginx的時候報錯 須要安裝PCRE

 ./configure --prefix=/mynginx/nginx

本地編譯nginx的時候 報錯 提示須要安裝PCREbash

錯誤信息:ui

./configure: error: the HTTP rewrite module requires the PCRE library.spa

You can either disable the module by using --without-http_rewrite_modulecode

option, or install the PCRE library into the system, or build the PCRE libraryblog

statically from the source with nginx by using --with-pcre=<path> option.ssl

 

下載最新版本pcreget

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

解壓到路經openssl

/usr/local/src
我下載安裝的是pcre2-10.32.tar
cd pcre2-10.32
./configure --prefix=/usr/local
詳細操做流程
cd /usr/local/src tar pcre2-10.32.tar
cd pcre2-10.32
./configure --prefix=/usr/local make sudo make install

安裝成功以後

從新回去編譯nginx
根據錯誤信息 須要增長參數 指定PCRE library的路經地址

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

從新編譯 成功.

 

修正:

一、

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


其中參數制定的是pcre源碼庫的位置路經 不是設置的prefix

 

二、不能夠用pcre2 用pcre2會報錯

src/core/ngx_regex.h:15:10: fatal error: 'pcre.h' file not found
#include <pcre.h>
^~~~~~~~
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

結果:

 

相關文章
相關標籤/搜索