mac 配置安装nginx

 Mac上安装软件很方便,AppStore上直接下载安装;但是这只对于一般日常使用,工作中需要各种软件,一般都是下载pkg安装包直接开启(整体拖拽入/Application或者删除即可卸载)。

 

相对于apt-get或者yum安装命令,Mac可以使用Homebrew(超好用),brew install XXX 你想的基本都有

 

今天在家配置nginx项目,然后 --- --- 

 

(1)配置

 

先是 Not Found  PCRE

对于不是常规安装路径的,使用--with-openssl=指定安装目录即可

 

(2)编译

 

 

通过后再编译 make && make install

报错了

./configure --disable-shared

 /bin/sh: ./: No such file or directory

或者 /bin/sh: ./configure: No such file or directory

 

想想以前都是在linux上安装直接是永远的openssl、pcre等,这里使用了brew直接安装好了(生成的安装编译后的目录)

在 ./configure --with-openssl=/usr/local/opt/openssl (此为编译安装后的目录)

然后下载源码,configure时候,指向源码包路径即可

 

 

./configure --with-openssl=/Users/chocolate/workspace/workInstall/openssl_1.1  --with-pcre=/Users/chocolate/workspace/workInstall/pcre_8.4/

 

 

一定注意:--with-openssl --with-pcre 等需要指向远吗包路径!

 

至于设置nginx为什么要去自己重现编译这些,我想应该是直接编译到nginx的安装目录吧。

 

 

(3)macOS 10.x 限制

 

编译没问题后,好大一会还是报错了

关键信息:

nginx error: 'OSAtomicAdd64' is deprecated: first deprecated in macOS 10.12

 

查阅后发现 https://trac.nginx.org/nginx/ticket/584 

Workaround:
Remove the -Werror or the -Wdeprecated-declarations options from the compilation flags

 

就在当前目录下找到 objs/Makefile 文件

看到第一行开始就是

 

CC =	cc
CFLAGS =  -pipe  -O -Wall -Wextra -Wpointer-arith -Wno-unused-parameter -Werror -g 
CPP =	cc -E
LINK =	$(CC) -rdynamic

Removing the -Werror makes it compile successfully!

 

 原文链接:http://zl378837964.iteye.com/blog/2368184

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值