Reputation: 1106
I always install nginx like this:
wget ...nginx...
tar zxvf ...
cd nginx...
./configure --with-pcre=../pcre_source_path
make && make install
nginx and pcre will installed to /usr/local/
but now I want to install them to /usr/local/lnmp/, so I try to config nginx like this:
./configure --with-pcre=../pcre_source_path --prefix=/usr/local/lnmp/nginx/
Then I am confused: where is my pcre installed? I found a /usr/local/share/doc/pcre so I think it's installed to /usr/local/
Then I tried to install pcre independently, so I did this:
wget ...pcre
tar zxvf pcre...
cd pcre...
./configure --prefix=/usr/local/lnmp/pcre
make && make install
with the command above, I installed pcre to /usr/local/lnmp/pcre/
successfully, but I can't compile nginx with that pcre...(I tried ./configure --with-pcre=/usr/local/lnmp/pcre/
, but it gives me an error, because it must be --with-pcre=[pcre_source_path]
)
Upvotes: 2
Views: 4741
Reputation: 9748
In this case, when compiling nginx against a custom compiled library, such as pcre, zlib and OpenSSL, you must use the options --with-cc-opt
and --with-ld-opt
.
In the situation described by you, the configure
command should be:
./configure --prefix=/usr/local/lnmp/nginx/ --with-cc-opt="-I /usr/local/lnmp/pcre/include" --with-ld-opt="-L /usr/local/lnmp/pcre/lib"
More references: Nginx forum, Nginx docs (installing).
Upvotes: 4