MacOS系統安裝軟件:
macos系統下沒有yum和apt-get命令,要安裝軟件需要使用homebrew。
1、安裝homebrew:
安裝:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
卸載:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
PS:如果出現ping github.com超時的情況,查找第三方ip,如192.30.253.112 github.com添加到/etc/hosts最后一行。
2、利用homebrew安裝、卸載軟件包:
$ brew install pcre bzip2 openssl
$ brew uninstall python
$ brew search <packageName>
$ brew list 查看已安裝
$ brew info <packageName> 查看包信息
$ brew -v
$ brew -h
$ brew install nginx 安裝過程會自己安裝依賴關系
$ brew services start nginx 啟動nginx
$ brew services stop nginx 關閉nginx
$ brew services reload nginx 重啟nginx
$ brew uninstall nginx 卸載nginx
3、nginx文件目錄結構:
nginx安裝文件目錄
(...網站路徑)
/usr/local/Cellar/nginx
nginx配置文件路徑
/usr/local/etc/nginx/nginx.conf
nginx日志文件路徑
/usr/local/var/log/
nginx運行pid文件路徑
/usr/local/var/run/
系統hosts文件位置
/private/etc/hosts
4、其他
注意事項:
macos x系統對權限的約束非常嚴格,不能用root執行腳本;
nginx.conf中user不能配置成root或macos,配置完會報錯;
運行時,目錄屬主:屬組,屬主需要改成conf中user的用戶,默認nobody,屬組改不了,默認staff(包含所有用戶的組),
但是即使如此,如果不配置屬主,nginx並不生效,也就是說這個組沒個卵用,目錄配成777也沒用。