mac下操作 nginx 安裝、重啟、解除安裝、檢視路徑
阿新 • • 發佈:2018-12-04
1. nginx
nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.
從niginx基本介紹上看到Other HTTP server features中有一項:
- FLV and MP4 streaming;
可知nginx也支援流媒體.
2. brew
brew又叫Homebrew,是Mac中的一款軟體包管理工具,通過brew可以很方便的在Mac中安裝軟體或者是解除安裝軟體.
一般Mac電腦會預設安裝有brew.
常用指令如下:
- brew 搜尋軟體
brew search nginx
- brew 安裝軟體
brew install nginx
- brew 解除安裝軟體
brew uninstall nginx
- brew 升級
sudo brew update
- 檢視安裝資訊(經常用到, 比如檢視安裝目錄等)
sudo brew info nginx
- 檢視已經安裝的軟體
brew list
brew list 執行結果
3. brew安裝nginx
- 安裝nginx
可以用brew很方便地安裝nginx.sudo brew install nginx
- 啟動nginx服務
sudo brew services start nginx
利用http://localhost:8080
進行訪問, 如果出現如下介面,說明啟動成功. - 檢視nginx版本
nginx -v
- 關閉nginx服務
sudo brew services stop nginx
另外幾個比較方便的指令
- 重新載入nginx
nginx -s reload
- 停止nginx
nginx -s stop