Enable ngx_http_ssl_module on Mac. error /bin/sh: ./config: No such file or directory
Issue
I compile the source code of Nginx on Mac OS, enable the ngx_http_ssl_module, and run the following commands.
$ ./configure --with-http_ssl_module
I get the error message saying:
checking for OpenSSL library ... not found
checking for OpenSSL library in /usr/local/ ... not found
checking for OpenSSL library in /usr/pkg/ ... not found
checking for OpenSSL library in /opt/local/ ... 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 install openssl
with brew
.
brew install openssl
Compile again.
$ ./configure --with-http_ssl_module --with-openssl=/usr/local/opt/openssl
$ make
An error message saying when run make
command.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f objs/Makefile
cd /usr/local/opt/openssl \
&& if [ -f Makefile ]; then /Applications/Xcode.app/Contents/Developer/usr/bin/make clean; fi \
&& ./config --prefix=/usr/local/opt/openssl/.openssl no-shared no-threads \
&& /Applications/Xcode.app/Contents/Developer/usr/bin/make \
&& /Applications/Xcode.app/Contents/Developer/usr/bin/make install_sw LIBDIR=lib
/bin/sh: ./config: No such file or directory
make[1]: *** [/usr/local/opt/openssl/.openssl/include/openssl/ssl.h] Error 127
make: *** [build] Error 2
Solution
Download the make
source code and unzip it.
$ cd ~/Downloads
$ curl -O https://www.openssl.org/source/openssl-1.1.1g.tar.gz
$ tar xf openssl-1.1.1g.tar.gz
Don't compile openssl
, just add the path of the openssl
to --with-openssl=
.
$ ./configure --with-http_ssl_module --with-openssl=/Users/apple/Downloads/openssl-1.1.1g
$ make
$ sudo make install