【异常】OS X 10.11( EI )上 Nginx 的 https moudle
2016-01-09 00:00
489 查看
摘要: 解决Mac 上源码安装 Nginx 时遇到的 https 问题
笔者在使用 nginx 第三方库
因此,在 openssl 的编译配置中,使用
这个不难,但是,笔者在使用做 nginx 源码编译安装时,源码编译的
在 10.10 及其之前的 OS X 版本 prefix 不配置即可(默认
准备编译nginx,记住先只进行 config ,不要急着 make
如果直接编译,openssl 会报错:
如果你不停止编译就会出错。这个问题应该是 openssl/config脚本猜对你的系统是64位,但是 会根据$KERNEL_BITS来判断是否开启x86_64编译,默认 是不开启的(很奇怪的设置,虽然会给你5秒时间停止编译并手动开启),所以你生成的openssl库文件是32位的,最后静态链接到nginx会出错。目前看来没有很好的方法把x86_64的参数传到openssl配置文件中 (openssl/config 猜测os架构,设置编译的参数是32位还是64位,默认是32位,然后调用openssl/Configure生成Makefile)
4.进入nginx目录,手动修改 objs/Makefile:
改成
开笔
自 OS X 10.11 起,Apple 对 OS X 系统的安全做了全新的升级,增加了诸多限制,如 我们再也不能ln自己编译安装的软件到
/usr/bin、
/usr/sbin了;自带的 openssl不再有 libssl-deve 的库了。
笔者在使用 nginx 第三方库
nginx-upload-module的时候无法绕开
https编译库。使用了 brew 安装 libssl-devel 失败、使用源码编译 openssl 也没找到办法连接或者配置lib的路径。最终选择with-openssl选项编译。
具体问题
在 Mac 上做过源码编译安装 openssl 开发者一定知道知道,需要手动指定64位。否则贼会出现如下警告:WARNING! If you wish to build 64-bit library, then you have to invoke ‘./Configure darwin64-x86_64-cc’ *manually*.
因此,在 openssl 的编译配置中,使用
./Configure darwin64-x86_64-cc,即可顺利安装。
这个不难,但是,笔者在使用做 nginx 源码编译安装时,源码编译的
openssl(prefix 配置到
/usr/local/openssl) nginx 依然无法找到 ssl lib 的路径;
在 10.10 及其之前的 OS X 版本 prefix 不配置即可(默认
/usr/local),是可以找到 ssl lib 的。但这个在 10.11 版本系统中无法使用。
解决步骤
使用源码编译,分别下载nginx,openssl,pcre准备编译nginx,记住先只进行 config ,不要急着 make
./configure \ --prefix=/usr/local/nginx \ --user=Jiafan \ --group=staff \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-mail \ --with-mail_ssl_module \ --with-pcre=/* source path to pcre */ \ --with-openssl=/* source path to openssl */ \ --add-module=/* source path to nginx upload module */
如果直接编译,openssl 会报错:
WARNING! If you wish to build 64-bit library, then you have to invoke ‘./Configure darwin64-x86_64-cc’ *manually*.
如果你不停止编译就会出错。这个问题应该是 openssl/config脚本猜对你的系统是64位,但是 会根据$KERNEL_BITS来判断是否开启x86_64编译,默认 是不开启的(很奇怪的设置,虽然会给你5秒时间停止编译并手动开启),所以你生成的openssl库文件是32位的,最后静态链接到nginx会出错。目前看来没有很好的方法把x86_64的参数传到openssl配置文件中 (openssl/config 猜测os架构,设置编译的参数是32位还是64位,默认是32位,然后调用openssl/Configure生成Makefile)
4.进入nginx目录,手动修改 objs/Makefile:
./config –prefix=/Users/xxx/Downloads/openssl-1.0.1e/.openssl no-shared no-threads
改成
./Configure darwin64-x86_64-cc –prefix=/Users/xxx/Downloads/openssl-1.0.1e/.openssl no-shared no-threads
收工
后面进行 make 和 make installPS
欢迎来到我github上的空间:https://jiafan.github.io相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- 使用OS Watcher监控操作系统
- Nginx+Naxsi部署专业级Web应用防火墙
- Linux下XWindow图形界面的基本概念
- CentOS 6.2实战部署Nginx+MySQL+PHP
- 什么是Mac OS X?跟Linux有什么区别
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- DOS命令全集(一)
- DOS下内存的配置
- 把Lua编译进nginx步骤方法
- SqlServer应用之sys.dm_os_waiting_tasks 引发的疑问(中)