I'm trying to compile nginx from source with the SSL module enabled. When I run this command:

./configure --with-http_ssl_module

it does its usual checks to see if everything is installed correctly, and then this pops up:

checking for OpenSSL library ... not found

./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl= option.

I know for a fact that OpenSSL is installed, because when I do openssl version I get OpenSSL 1.0.1 14 Mar 2012

So I'm pretty stumped. I thought maybe OpenSSL isn't isntalled in its default location, which is why nginx can't find it, but I have no idea where this is as it came pre-installed with the server. How can I find out where this is?

The server is running Ubuntu 12.04 LTS.


  • 2
    For people using yum (CentOS | redhat | fedora) try installing openssl-devel and then try running the command.
    – maverick3
    Feb 4, 2015 at 7:24

6 Answers 6


Most likely you're missing the libssl-dev package.

But why not save yourself all the trouble and just use a PPA for nginx?

  • What exactly are PPA's? From what I can gather people can upload packages to be installed using apt-get? I thought the best way to ensure I was always getting the latest version of software was to compile it from the source from the website. Aug 11, 2012 at 18:42
  • 1
    PPAs are Personal Package Archives. As you said, they are to distribute dpkg packages. Compiling from source might get you the newest version but this is not always necessary. Information for Ubuntu and the PPA can be found here: wiki.nginx.org/Install#Official_Debian.2FUbuntu_packages Aug 11, 2012 at 19:29
  • The info on the nginx wiki is good. It will eventually lead you to the PPA that I linked. :) Aug 11, 2012 at 19:43
  • Alright thanks, I'll look into using PPA's in the future. But for this problem, installing libssl-dev worked. :) Aug 11, 2012 at 21:05
  • The Nginx PPA is the way to go as it provides the latest official Nginx binary through apt. Ubuntu typically provides an Nginx version a few releases back for support purposes, but using the Nginx PPA, you can get the latest release from Nginx.org. Much easier to use this approach over compiling from source & great for automated provisioning scripts. It keeps your apt on your system aware of the Nginx version currently installed making apt-based updates much easier. Unless there is a specific reason to compile from source, the PPA approach is so much easier to maintain in production.
    – Joe J
    Aug 22, 2015 at 16:09

I used the following to get openssl for nginx:


All other attempts either did not work, or were to clunky.

Hope this helps another...

  • 2
    Helped me figure out the --with-openssl= flag is to point to the source files. If you want to link against an already-compiled/system OpenSSL that nginx's ./configure can't find see this forum post: --with-cc-opt="-I /usr/local/include" --with-ld-opt="-L/usr/local/lib64 -ldl -Wl,-rpath,/usr/local/lib64" (YMMV).
    – vesperto
    Oct 26, 2019 at 16:48
  • Thanks for the additional reference @vesperto
    – skidadon
    Nov 1, 2019 at 4:03

In case you want to check that libssl is installed in the right place, you can type which openssl and then ldd /path/to/openssl.


Even when OpenSSL is already installed (brew install openssl), configure itself suggests a workaround, which worked for me:

./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master--with-openssl=~/GitHub/openssl/openssl

  • Is the option --with-openssl= pointing at a cloned openssl github repo? You might consider editing your answer to reflect this as it could be confusing for people without sufficient understanding. Feb 9, 2019 at 8:37
  • yes, /GitHub/openssl/openssl is a cloned repository of github.com/openssl/openssl.git
    – Pnemonic
    Feb 9, 2019 at 18:35

If anyone still facing issue compiling nginx from source with the pcre related error, compile with "--with-pcre" attribute. And for providing pcre path, don't provide installed path. Provide pcre software path.

  1. Install pcre with



sudo make install

Then, provide the path of pcre source path.

./configure --prefix=/path/to/nginxToBeInstalled/mayBeInOpt/nginx-1.16.0/ --with-openssl=/path/to/installed/openssl-1.1.1b/ --with-pcre=/path/to/your/downloaded/extracted/pcre-8.42

In my case,

./configure --prefix=/opt/nginx-1.16.0/ --with-openssl=/opt/openssl-1.1.1b/ --with-pcre=/media/username/personal/Software/pcre-8.42

Thank you.


You have to specify the path were OpenSSL libraries set add it like this

PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig/" ./configure \

I found it path by searching for openssl.pc file find / -name 'openssl.pc' reference

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .