Monday, 24 October 2011

Nginx compilation : PCRE Library Not Found

The HTTP rewrite module requires the PCRE library during the Nginx compilation. The PCRE package contains Perl Compatible Regular Expression libraries useful for implementing regular expression pattern matching.

If PCRE is not installed on the server, it will result in the following error message during the Nginx compliation
checking for PCRE library ... not found
checking for PCRE library in /usr/local/ ... not found
checking for PCRE library in /usr/include/pcre/ ... not found
./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.


How to Install the PCRE library? SSH to the server as user ‘root’

1) First, goto a temporary directory

 # cd /usr/local/src


2) Download PCRE:

 # wget http://downloads.sourceforge.net/pcre/pcre-8.10.tar.bz2


3) Unpack and change to the pcre directory

 # tar -jxf pcre-8.10.tar.bz2 # cd pcre-8.10


4) Confiure PCRE:

 # ./configure


5) Create the installation files and install PCRE

 # make # make install


Once done, you should be able to install Nginx with the HTTP rewrite module.

No comments:

Post a Comment