Can't compile nginx with SSL support, OpenSSL not found
Solution 1
Most likely you're missing the libssl-dev
package.
But why not save yourself all the trouble and just use a PPA for nginx?
Solution 2
I used the following to get openssl for nginx:
https://ethitter.com/2016/06/nginx-openssl-1-0-2-http-2-alpn/
All other attempts either did not work, or were to clunky.
Hope this helps another...
Related videos on Youtube
James Linton
Updated on September 18, 2022Comments
-
James Linton over 1 year
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 getOpenSSL 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.
Thanks.
-
maverick3 over 9 yearsFor people using yum (CentOS | redhat | fedora) try installing openssl-devel and then try running the command.
-
-
James Linton almost 12 yearsWhat 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. -
Christopher Perrin almost 12 yearsPPAs 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
-
Michael Hampton almost 12 yearsThe info on the nginx wiki is good. It will eventually lead you to the PPA that I linked. :)
-
sergzach over 5 yearsWhy not just use a PPA: for instance, when you want old NGINX (with obsolete features) compiled from sources. Am I wrong?
-
Michael Hampton over 5 years@sergzach I'm sure there's some circumstance in which you might want to run an obsolete release of nginx, but at the moment I really can't think of one.
-
Jamie Lindsey over 5 yearsIs 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. -
Pnemonic over 5 yearsyes, /GitHub/openssl/openssl is a cloned repository of github.com/openssl/openssl.git
-
sknt about 5 yearsBuilding from source is required if you want ngx_pagespeed or other compile time options. nginx.com/resources/wiki/start/topics/tutorials/installoptions
-
vesperto over 4 yearsHelped 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). -
skidadon over 4 yearsThanks for the additional reference @vesperto