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