Mac 系统启用 Nginx 的 http_ssl_module 出错 /bin/sh: ./config: No such file or directory

Nginx 2020-09-07 阅读 133 评论 0

问题描述

在 Mac 系统,编译 Nginx 的源码,启动 http_ssl 模块,运行以下命令。

$ ./configure --with-http_ssl_module

但是最后报错了。

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.

按照提示,安装了 openssl

brew install openssl

重新编译

$ ./configure --with-http_ssl_module --with-openssl=/usr/local/opt/openssl
$ make

运行 make 报错了。

/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

解决方法

下载 openssl 源码并解压。

$ curl -O https://www.openssl.org/source/openssl-1.1.1g.tar.gz
$ tar xf openssl-1.1.1g.tar.gz

不用编译 openssl 源码,重新带上 openssl 源码的路径。

$ ./configure --with-http_ssl_module --with-openssl=/Users/apple/Downloads/packages/openssl-1.1.1g
$ make
$ sudo make install
最后更新 2020-09-07
MIP.watch('startSearch', function (newVal, oldVal) { if(newVal) { var keyword = MIP.getData('keyword'); console.log(keyword); // 替换当前历史记录,新增 MIP.viewer.open('/s/' + keyword, {replace: true}); setTimeout(function () { MIP.setData({startSearch: false}) }, 1000); } }); MIP.watch('goHome', function (newVal, oldVal) { MIP.viewer.open('/', {replace: false}); });