之前在Mac系统中安装了一个基础的nginx,没有添加什么扩展,由于公司网站引入了https,本地环境自然要同步,不过在安装过程中遇到了好多问题,几经周折才得以安装成功,先将安装过程梳理一下,分享给大家。
1 安装openssl
brew remove openssl
brew install openssl
2 Nginx编译安装过程中一直报如下错误:
./configure --prefix=/usr/local/nginx-2 --without-http_rewrite_module --with-openssl=../openssl-1.0.2m --with-http_ssl_module
Configured for darwin-i386-cc.
wanzhihuideMacBook-Pro:openssl-1.0.2e wanzhihui$ sudo ./config --prefix=/usr/local/ --openssldir=/usr/local/openssl darwin64-x86_64-cc
Operating system: i686-apple-darwinDarwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64
WARNING! If you wish to build 64-bit library, then you have to
invoke './Configure darwin64-x86_64-cc' *manually*.
You have about 5 seconds to press Ctrl-C to abort.
3 解决2的错误,下载同版本的openssl到本地
wget https://www.openssl.org/source/openssl-1.0.2m.tar.gz
tar zxvf openssl-1.0.2m.tar.gz
cd openssl-1.0.2m
vim Makefile
找到makefile 将里面的PLATFORM=dist改成
PLATFORM=darwin64-x86_64-cc
在终端工具中再敲入
export KERNEL_BITS=64
./config darwin64-x86_64-cc --prefix=/usr/local/Cellar/openssl
重新编译安装,成功。