mac os x 10 13編譯安裝nginx

2021-09-14 04:44:32 字數 1666 閱讀 8861

我選擇的是 stable version 中的 1.12.2,是適用於生產環境的最新穩定版本。

mv nginx-1.12.2.tar.gz /usr/local/bin
在官方文件中可以找到 installing nginx → building nginx from sources,這裡介紹了很多編譯時可配置的選項,大多是各種路徑的配置以及依賴的模組。最下面給出了乙個配置示例:

--with-zlib=../zlib-1.2.11對於路徑,因為我是新手,所以決定不做配置,用預設的就好;

對於模組,看起來這幾個還是要配置一下的。

zlib 直接選擇官網首頁最新的 1.2.11 版本就可以,也是示例中的版本。

同樣把這幾個庫解壓,然後也移動到/usr/local/bin(和 nginx 同目錄):

mv openssl-1.1.0g pcre-8.41 zlib-1.2.11 /usr/local/bin
進入之前解壓的 nginx 目錄:

cd /usr/lcoal/bin/nginx-1.12.2
執行配置命令,幾個依賴包的路徑對就可以,官方文件提示要寫到一行:

./configure --with-http_ssl_module --with-pcre=../pcre-8.41 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.0g
一陣 checking 無報錯資訊之後配置成功——

其實我最開始沒有裝 openssl,配置的報錯提示還是很友好的:

./configure: error: ssl modules require the openssl library.

you can either do not enable the modules, or install the openssl library

into the system, or build the openssl library statically from the source

with nginx by using --with-openssl=option.

所以後面我就配置了--with-openssl

——然後就可以編譯了:

make
一陣編譯無報錯資訊之後安裝:

sudo make install
趕緊試一試:

cd /usr/local/nginx

sudo sbin/nginx

去瀏覽器開啟 127.0.0.1,看到 nginx 的歡迎頁就大功告成啦。

Mac OS X 下編譯安裝 Nginx

當前穩定版本 zlib 當前穩定版本 注 nginx 參考文件中提到需要 1.1.3 1.2.7 版本的 zlib pcre 當前穩定版本 注 nginx 參考文件中提到需要 4.4 8.32 版本的 pcre 解壓依賴原始碼包 tar zxvf zlib 1.2.8.tar.gz 得到 zlib ...

Mac OS X 下編譯安裝 Nginx

nginx原始碼包 當前穩定版本 zlib 當前穩定版本 zlib 1.2.8.tar.gz 注 nginx 參考文件中提到需要 1.1.3 1.2.7 版本的zlib 當前穩定版本 ftp 8.36 tar.gz 注 nginx 參考文件中提到需要 4.4 8.32 版本的pcre 解壓依賴原始碼...

ubuntu安裝Mac OS X主題

mac os x的華麗介面是大家想買蘋果電腦的乙個重要因素,因為ubuntu的介面定製比較靈活,今天仔細嘗試了幾種方法在ubuntu下配飾mac os x主題。其中包括epidermis一鍵安裝mac os x主題桌面,macbuntu主題包以及手動配置mac4lin的方法。我和朋友兩人主要嘗試了m...