Ubuntu 使用现有pcre编译nginx?

Ubuntu 使用现有pcre编译nginx?,ubuntu,nginx,pcre,Ubuntu,Nginx,Pcre,我总是这样安装nginx: wget ...nginx... tar zxvf ... cd nginx... ./configure --with-pcre=../pcre_source_path make && make install ./configure --with-pcre=../pcre_source_path --prefix=/usr/local/lnmp/nginx/ nginx和pcre将安装到/usr/local/ 但现在我想将它们安装到/usr/l

我总是这样安装nginx:

wget ...nginx...
tar zxvf ...
cd nginx...
./configure --with-pcre=../pcre_source_path
make && make install
./configure --with-pcre=../pcre_source_path --prefix=/usr/local/lnmp/nginx/
nginx和pcre将安装到/usr/local/

但现在我想将它们安装到/usr/local/lnmp/,所以我尝试如下配置nginx:

wget ...nginx...
tar zxvf ...
cd nginx...
./configure --with-pcre=../pcre_source_path
make && make install
./configure --with-pcre=../pcre_source_path --prefix=/usr/local/lnmp/nginx/
然后我很困惑:我的pcre安装在哪里?我找到了一个/usr/local/share/doc/pcre,所以我认为它安装到了/usr/local/

然后我尝试独立安装pcre,所以我这样做:

wget ...pcre
tar zxvf pcre...
cd pcre...
./configure --prefix=/usr/local/lnmp/pcre
make && make install

使用上面的命令,我成功地将pcre安装到
/usr/local/lnmp/pcre/
,但我无法用该pcre编译nginx…(我尝试了
/configure--with pcre=/usr/local/lnmp/pcre/
,但它给了我一个错误,因为它必须是
--with pcre=[pcre\u source\u path]

<,在针对自定义编译库(如pcre、zlib和OpenSSL)编译nginx时,必须使用选项
--使用cc opt
--使用ld opt

在您描述的情况下,
configure
命令应为:

./configure --prefix=/usr/local/lnmp/nginx/ --with-cc-opt="-I /usr/local/lnmp/pcre/include" --with-ld-opt="-L /usr/local/lnmp/pcre/lib"
更多参考资料: