[Nginx Error]: Compiling nginx on CentOS : PCRE Library problem and a quick solution

Updated on September 2, 2017

While building nginx from source on CentOS/RHEL machine, encountered a very strange error as shown below:

./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.

I was wondering what this heck PCRE Library? I had never heard of it! After Googling, found that PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. HTTP rewrite module of Nginx uses this PCRE library.

Solution: Install PCRE Library

You can install PCRE library using YUM as shown below:

yum install pcre

Once installed, again tried to compile Nginx and still faced the same error! Now found out the “pcre-devel” also need to be installed. You can install pcre-devel package using the below command:

yum install pcre-devel

Now compiling Nginx, went smooth, without any error 🙂

Was this article helpful?

Related Articles

Leave a Comment