./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=<path> option.
下載最新版本pcre
解壓到路經
/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/
重新編譯 成功.
修正:
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 <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
結果: