Mac OS X 10.15 編譯和安裝 Nginx

想在本身電腦裏裝個 Nginx 來進行各類測試,下面是詳細的過程記錄:鄭州哪家醫院治療不孕不育好:http://jbk.39.net/yiyuanfengcai/tsyl_zztjyy/986/nginx

1. 下載軟件

首先建個臨時目錄 nginx-src 並下載所需軟件的源碼進行配置xcode

mkdir nginx-srccd 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 *.gzcd 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 指定的路徑請使用絕對路徑瀏覽器

2. 錯誤處理

若是在執行 configure 腳本時報以下錯誤:app

checking for OS + Darwin 19.2.0 x86_64checking for C compiler ... not found./configure: error: C compiler cc is not found

嘗試執行 gcc 出以下錯誤ide

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), 
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

執行:xcode-select --install  根據界面提示操做測試

3. 繼續安裝

./configure --with-pcre=../pcre-8.41/ --with-http_ssl_module --with-openssl=../openssl-1.1.0g --prefix=/Users/winterlau/nginxspa

可看到相關信息以下:鄭州哪家不孕不育醫院好:http://www.zztjby.com/.net

Configuration summary  + using PCRE library: ../pcre-8.41/  + using OpenSSL library: ../openssl-1.1.0g  + using system zlib library

開始編譯安裝code

make
make install

4. 啓動 Nginx 並測試

因爲默認的 nginx 運行在 80 端口上,所以須要有管理員的權限:orm

cd ../../nginx
sudo sbin/nginx

打開瀏覽器訪問 http://localhost

相關文章
相關標籤/搜索