Nginx configure error: the HTTP rewrite module requires the PCRE library
Issue
When configure nginx 1.19.0, run the commands.
./configure --prefix=/opt/nginx-1.19.0But the following error occurs.
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
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... 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.Solution
You need to install pcre.
1. Mac OS
Download pcre in the official website http://www.pcre.org/, such as pcre-8.44.zip, and run:
$ unzip pcre-8.44.zip
$ cd pcre-8.44
$ pwd
/Users/cpm/Downloads/packages/pcre-8.44Copy your unzip path of pcre-8.44.zip, configure nginx again.
./configure --prefix=/opt/nginx-1.19.0 --with-pcre=/Users/cpm/Downloads/packages/pcre-8.442. Ubuntu/Debian
- Use the method from step 1 above.
- On the https://pkgs.org/search/?q=libpcre webpage, find the
libpcreandlibpcre-devpackages that match your operating system, download and install. - Use the
apt-getcommand.
sudo apt-get install libpcre3-dev3. RHEL/CentOS
- Use the method from step 1 above.
- On the https://pkgs.org/search/?q=pcre webpage, find the
pcreandpcre-develpackages that match your operating system, download and install. - Use the
yumcommand.
sudo yum install pcre-devel