MAC 安装nginx

nginx下载并解压

curl -O http://nginx.org/download/nginx-1.16.0.tar.gz
tar -xvf nginx-1.16.0.tar.gz

openssl下载

https://ftp.openssl.org/source/

curl -O https://ftp.openssl.org/source/openssl-1.0.2r.tar.gz
tar -xvf openssl-1.0.2r.tar.gz

zlib下载

curl -O https://zlib.net/zlib-1.2.11.tar.gz
tar -xvf zlib-1.2.11.tar.gz

pcre下载

https://ftp.pcre.org/pub/pcre/

curl -O https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar -xvf pcre-8.43.tar.gz

nginx-upload-module

nginx-upload-module用于文件上传

git clone https://github.com/fdintino/nginx-upload-module.git

安装

到nginx解压目录

./configure --with-http_ssl_module --with-pcre=../pcre-8.43 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.2r  --with-cc-opt=-m64 --with-ld-opt=-m64

然后到objs目录修改Makefile
找到&& ./config --prefix=/Users/anjian/dev/nginx-1.16.0/../openssl-1.0.2r/.openssl no-shared no-threads
将config修改为
Configure darwin64-x86_64-cc
那么整个就变成
&& ./Configure darwin64-x86_64-cc --prefix=/Users/anjian/dev/nginx-1.16.0/../openssl-1.0.2r/.openssl no-shared no-threads \

然会回到nginx目录
执行安装

sudo make install

启动nginx

sudo /usr/local/nginx/sbin/nginx

你可能感兴趣的:(MAC 安装nginx)