這篇文章主要講解了“Mac OS編譯安裝Nginx的詳細步驟”,文中的講解內容簡(jiǎn)單清晰,易于學(xué)習與理解,下面請大家跟著(zhù)小編的思路慢慢深入,一起來(lái)研究和學(xué)習“Mac OS編譯安裝Nginx的詳細步驟”吧!
首先建個(gè)臨時(shí)目錄 nginx-src 并下載所需軟件的源碼進(jìn)行配置下載軟件
mkdir nginx-src cd nginx-src wget http://nginx.org/download/nginx-1.17.8.tar.gz wget https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz tar zxvf *.gz cd nginx-1.17.8 ./configure --with-pcre=../pcre-8.41/ --with-http_ssl_module --with-openssl=../openssl-1.1.0g --prefix=/Users/winterlau/nginx
這里我們將 nginx 安裝在 /Users/winterlau/nginx 目錄下,prefix 指定的路徑請使用絕對路徑
錯誤處理
如果在執行 configure 腳本時(shí)報如下錯誤:
checking for OS + Darwin 19.2.0 x86_64 checking for C compiler ... not found ./configure: error: C compiler cc is not found
嘗試執行 gcc 出如下錯誤
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
執行:xcode-select --install 根據界面提示操作
繼續安裝
./configure --with-pcre=../pcre-8.41/ --with-http_ssl_module --with-openssl=../openssl-1.1.0g --prefix=/Users/winterlau/nginx
可看到相關(guān)信息如下:
Configuration summary + using PCRE library: ../pcre-8.41/ + using OpenSSL library: ../openssl-1.1.0g + using system zlib library
開(kāi)始編譯安裝
make make install
啟動(dòng) Nginx 并測試
由于默認的 nginx 運行在 80 端口上,因此需要有管理員的權限:
cd ../../nginx sudo sbin/nginx
打開(kāi)瀏覽器訪(fǎng)問(wèn) http://localhost
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。
Copyright ? 2009-2022 56dr.com. All Rights Reserved. 特網(wǎng)科技 特網(wǎng)云 版權所有 特網(wǎng)科技 粵ICP備16109289號
域名注冊服務(wù)機構:阿里云計算有限公司(萬(wàn)網(wǎng)) 域名服務(wù)機構:煙臺帝思普網(wǎng)絡(luò )科技有限公司(DNSPod) CDN服務(wù):阿里云計算有限公司 百度云 中國互聯(lián)網(wǎng)舉報中心 增值電信業(yè)務(wù)經(jīng)營(yíng)許可證B2
建議您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流瀏覽器瀏覽本網(wǎng)站