Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing NGINX from source with pcre and openssl throws error on make

I'm attempting to install NGINX from source on Ubuntu 14.04.3 LTS [via DigitalOcean] but I'm having issues during the make process.

Here is my bash script:

wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar xzf nginx-1.8.0.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.20.tar.gz
tar xzf pcre2-10.20.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
tar xzf zlib-1.2.8.tar.gz
wget https://openssl.org/source/openssl-1.0.2e.tar.gz
tar xzf openssl-1.0.2e.tar.gz
cd nginx-1.8.0
./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/etc/nginx.conf --user=nginx --group=nginx --with-http_ssl_module --with-pcre=/root/src/pcre2-10.20 --with-zlib=/root/src/zlib-1.2.8 --with-openssl=/root/src/openssl-1.0.2e
make

I get the following errors:

make[2]: Entering directory `/root/src/pcre2-10.20'
make[2]: *** No rule to make target `libpcre.la'.  Stop.
make[2]: Leaving directory `/root/src/pcre2-10.20'
make[1]: *** [/root/src/pcre2-10.20/.libs/libpcre.a] Error 2
make[1]: Leaving directory `/root/src/nginx-1.8.0'
make: *** [build] Error 2

I checked the gcc version using gcc -v and it says 4.8.4.

How can I fix this?

UPDATE

It turns out that the PCRE version I was using was the wrong one, so I changed to version 1 and everything worked. Here's the updated bash script:

wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar xzf nginx-1.8.0.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
tar xzf pcre-8.38.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
tar xzf zlib-1.2.8.tar.gz
wget https://openssl.org/source/openssl-1.0.2e.tar.gz
tar xzf openssl-1.0.2e.tar.gz
cd nginx-1.8.0
./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/etc/nginx.conf --user=nginx --group=nginx --with-http_ssl_module --with-pcre=/root/src/pcre-8.38 --with-zlib=/root/src/zlib-1.2.8 --with-openssl=/root/src/openssl-1.0.2e
make

Thanks to @EtanReiser for the find.

like image 758
ObiHill Avatar asked Oct 27 '25 16:10

ObiHill


1 Answers

You are using the wrong version of PCRE.

You are trying to use the PCRE2 version of the library but nginx requires the PCRE version of the library.

From the docs:

--with-pcre=path — sets the path to the sources of the PCRE library. The library distribution (version 4.4 — 8.32) needs to be downloaded from the PCRE site and extracted. The rest is done by nginx’s ./configure and make. The library is required for regular expressions support in the location directive and for the ngx_http_rewrite_module module.

like image 115
Etan Reisner Avatar answered Oct 29 '25 06:10

Etan Reisner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!