macos系統安裝nginx

 

MacOS系統安裝軟件:python


macos系統下沒有yum和apt-get命令,要安裝軟件須要使用homebrew。nginx

一、安裝homebrew:git

安裝:
/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)"github

PS:若是出現ping github.com超時的狀況,查找第三方ip,如192.30.253.112 github.com添加到/etc/hosts最後一行。macos

二、利用homebrew安裝、卸載軟件包:ruby

$ 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 卸載nginxcurl

三、nginx文件目錄結構:網站

nginx安裝文件目錄
(...網站路徑)
/usr/local/Cellar/nginxurl


nginx配置文件路徑
/usr/local/etc/nginx/nginx.conf日誌


nginx日誌文件路徑
/usr/local/var/log/

nginx運行pid文件路徑
/usr/local/var/run/

系統hosts文件位置

/private/etc/hosts

四、其餘

注意事項:macos x系統對權限的約束很是嚴格,不能用root執行腳本;nginx.conf中user不能配置成root或macos,配置完會報錯;運行時,目錄屬主:屬組,屬主須要改爲conf中user的用戶,默認nobody,屬組改不了,默認staff(包含全部用戶的組),可是即便如此,若是不配置屬主,nginx並不生效,也就是說這個組沒個卵用,目錄配成777也沒用。

相關文章
相關標籤/搜索