nginx ./configure can't find openssl

41,054

Solution 1

This can also occur when your nginx configure uses relative paths. It finds the libraries much more reliably if full paths from / are used instead.

Doesn't work: ./configure --with-openssl=../openssl-source

Works: ./configure --with-openssl=/home/build/src/openssl-source

Solution 2

./configure —with-cc-opt="-I/usr/local/opt/openssl/include" --with-ld-opt="-L/usr/local/opt/openssl/lib"

Solution 3

If you are trying to build nginx with macOS and openssl is installed via brew, the openssl library is installed under path like: /usr/local/opt/openssl. From brew info openssl

This formula is keg-only, which means it was not symlinked into /usr/local,

because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

In case like this, as @Bingnan said, you can let the configure script know the include and lib paths of openssl via --with-cc-opt and --with-ld-opt:

./configure --with-cc-opt="-I/usr/local/opt/openssl/include" --with-ld-opt="-L/usr/local/opt/openssl/lib"

Solution 4

I can't quite recall exactly what the issue was here, but I'm assuming that a symlink to /usr/local/ssl (or openssl?) to wherever openssl actually resides would solve the issue. I haven't had any problems installing nginx with SSL support in Ubuntu 10.04 with the default OpenSSL. So I would recommend anyone struggling with this to try that out.

Also, you probably need the correct dev packages installed. Here is what I typically installing prior to install nginx..

2  apt-get update
3  apt-get install gcc
4  apt-get install g++
5  wget http://www.python.org/ftp/python/2.7/Python-2.7.tgz
6  wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz
7  wget http://zlib.net/zlib-1.2.5.tar.gz
8  ls
9  gzip -d pcre-8.12.tar.gz 
10  gzip -d zlib-1.2.5.tar.gz 
11  gzip -d Python-2.7.tgz 
12  tar -xvf zlib-1.2.5.tar 
13  cd zlib-1.2.5
14  ./configure 
15  make
16  ls
17  Makefile
18  ls
19  ./configure 
20  make
21  sudo apt-get install build-essential
22  make
23  make install
24  cd ..
25  ls
26  tar -xvf pcre-8.12.tar 
27  cd pcre-8.12
28  ./configure --prefix=/usr --enable-unicode-properties
29  make
30  make install
31  cd ..
32  ls
33  tar -xvf Python-2.7.tar 
34  apt-get install openssl
35  cd Python-2.7
36  apt-get install libssl-dev
37  apt-get install libperl-dev
38  ./configure --help
39  ./configure --enable-ipv6
40  make
41  make install
Share:
41,054

Related videos on Youtube

Chris
Author by

Chris

Updated on September 17, 2022

Comments

  • Chris
    Chris over 1 year

    I'm trying to install nginx and no matter what I do, nginx can't seem to find my openssl path. It looks like it's searching for files that don't exist in any of the openssl directories. Below is my make output. I've tried to specify various paths for nginx to look in for openssl.

    [root@server nginx-0.8.54]# make
    make -f objs/Makefile
    make[1]: Entering directory `/root/nginx-0.8.54'
    cd /usr/local/ssl \
            && make clean \
            && ./config --prefix=/usr/local/ssl/.openssl no-shared  no-threads \
            && make \
            && make install LIBDIR=lib
    make[2]: Entering directory `/usr/local/ssl'
    make[2]: *** No rule to make target `clean'.  Stop.
    make[2]: Leaving directory `/usr/local/ssl'
    make[1]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error 2
    make[1]: Leaving directory `/root/nginx-0.8.54'
    make: *** [build] Error 2
    

    Anyone have any thoughts on this?

  • Admin
    Admin about 13 years
    package managers aren't the latest versions. I'd rather upgrade everything myself. I'm running on CentOS 5.5 though. I'm using the --with-openssl=DIR option, but it's looking for files in my openssl path that don't exist.
  • Admin
    Admin about 13 years
    You'll need libssl-devel on CentOS.
  • Admin
    Admin about 13 years
    The package is named differently than that on CentOS.. I ended up switching to Ubuntu and got everything working. Thanks for the help though.
  • jaygooby
    jaygooby almost 10 years
    Great, worked for me. I was using ~/src/openssl-1.0.1 and it was failing. Using /home/me/src/openssl-1.0.1 fixed it.
  • Admin
    Admin over 8 years
    In current Ubuntu the command is ./configure --with-openssl=/usr/include/openssl/
  • peterh
    peterh over 6 years
    It is better, if you also explain, what does this command actually do. Single commands can really understable only by the people knowing them anyways. Bruce Lee.
  • Danila Vershinin
    Danila Vershinin about 4 years
    This points to the existing custom installation of pre-built OpenSSL. Contrary to --with-openssl, which compiles OpenSSL statically into NGINX binary.