MacOS 安装配置nginx

运行环境:

uname -a
Darwin 192.168.0.108 19.0.0 Darwin Kernel Version 19.0.0: Wed Oct 23 18:29:05 PDT 2019; root:xnu-6153.41.3~44/RELEASE_X86_64 x86_64

make出现的问题:

在编译过程中出现大约5s的暂停,编译完成后出现错误:
ld
: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

nginx附加依赖库:pcre-8.43.tar.gz zlib-1.2.11.tar.gz openssl-1.0.2u.tar.gz 分别解压

问题分析:

翻看编译记录发现问题出现在openssl编译 经过大神指导说是默认不能编译为x86_64内核支持(默认似乎是i386,但因为本地是x86_64,两个平台不一致)

 解决方法:

第一步:重新配置

 1   ./configure --prefix=/usr/local/nginx \
 2   --sbin-path=/usr/local/nginx/nginx \
 3   --modules-path=/usr/local/nginx/modules \
 4   --conf-path=/usr/local/nginx/conf/nginx.conf \
 5   --error-log-path=/usr/local/nginx/logs/error.log \
 6   --pid-path=/usr/local/nginx/logs/nginx.pid \
 7   --lock-path=/usr/local/nginx/logs/nginx.lock \
 8   --user=pawn \
 9   --group=staff \
10   --with-select_module \
11   --without-select_module \
12   --with-poll_module \
13   --with-threads \
14   --with-http_ssl_module \
15   --with-http_v2_module  \
16   --with-http_realip_module  \
17   --with-http_addition_module  \
18   --with-http_gunzip_module \
19   --with-http_gzip_static_module \
20   --with-http_perl_module \
21   --with-http_perl_module=dynamic \
22   --with-perl_modules_path=/usr/local/nginx/modules \
23   --with-perl=/usr/bin/perl \
24   --http-log-path=/usr/local/nginx/logs/access.log \
25   --http-client-body-temp-path=/usr/local/nginx/temp/client_body_temp \
26   --http-proxy-temp-path=/usr/local/nginx/temp/proxy_temp \
27   --http-fastcgi-temp-path=/usr/local/nginx/temp/fastcgi_temp \
28   --http-uwsgi-temp-path=/usr/local/nginx/temp/uwsgi_temp \
29   --http-scgi-temp-path=/usr/local/nginx/temp/scgi_temp \
30   --with-mail \
31   --with-mail=dynamic \
32   --with-mail_ssl_module  \
33   --with-stream \
34   --with-stream=dynamic \
35   --with-stream_ssl_module \
36   --with-stream_realip_module \
37   --with-stream_ssl_preread_module  \
38   --with-compat \
39   --with-pcre  \
40   --with-pcre=/Users/pawn/Downloads/pcre-8.43 \
41   --with-pcre-jit \
42   --with-zlib=/Users/pawn/Downloads/zlib-1.2.11 \
43   --with-openssl=/Users/pawn/Downloads/openssl-1.0.2u \
44   --with-debug

 

第二步:修改上一步生成的编译文件 objs/Makefile,找到openssl配置

MacOS 安装配置nginx_第1张图片

 

 

./Configure darwin64-x86_64-cc

 

保存然后进行编译即可

你可能感兴趣的:(MacOS 安装配置nginx)