MAC OSX 安装Nginx
1. 环境准备
软件包 |
版本 |
下载地址 |
pcre |
pcre-8.38.tar.gz |
http://www.pcre.org/ |
openssl |
openssl-1.0.2h.tar.gz |
https://www.openssl.org/ |
nginx |
nginx-1.10.1.tar.gz |
http://nginx.org/ |
2. 安装步骤
2.1 解压nginx
,并进入nginx
解压目录,新建bundle
目录
$ tar -zxvf nginx-1.10.1.tar.gz
$ cd nginx-1.10.1
$ mkdir bundle
2.2 解压pcre
,并将解压后的整个目录复制到nginx-1.10.1/bundle
目录下
$ tar -zxvf pcre-8.38.tar.gz
$ mv pcre-8.38 nginx-1.10.1/bundle/
2.3 解压openssl
,并将解压后的整个目录复制到nginx-1.10.1/bundle
目录下
$ tar -zxvf openssl-1.0.2h.tar.gz
$ mv openssl-1.0.2h nginx-1.10.1/bundle/
2.4 编译
$ cd nginx-1.10.1
$ sudo ./configure --prefix=/usr/local/nginx/ --with-openssl=bundle/openssl-1.0.2h --with-pcre=bundle/pcre-8.38 --with-cc-opt="-Wno-deprecated-declarations"
$ cd nginx-1.10.1
$ sudo ./configure --prefix=/usr/local/nginx/ --with-http_ssl_module --with-pcre=bundle/pcre-8.38 --with-cc-opt="-Wno-deprecated-declarations"
项目 |
说明 |
--prefix=/usr/local/nginx/ |
nginx安装成功后所在目录 |
--with-openssl=bundle/openssl-1.0.2h |
nginx依赖的openssl 库源文件目录 |
--with-http_ssl_module |
nginx依赖的openssl 模块,若是系统中已经安装了openssl 库,那么将此选项替换上面的选项 |
--with-pcre=bundle/pcre-8.38 |
nginx依赖的pcre 库源文件目录 |
--with-ld-opt="-L /usr/local/pcre-8.36/lib" |
指定nginx依赖的pcre 库所在目录 |
--with-cc-opt="-Wno-deprecated-declarations" |
忽略错误 |
2.5 make并安装
$ cd nginx-1.10.1
$ sudo make
$ sudo make install