mac默認安裝了apache,隨機啓動會佔用80端口,致使nginx啓動不了,須要關閉apache(httpd)服務,取消隨機啓動。css
執行命令nginx
查詢80端口被誰佔用了sql
sudo lsof -i:80
關閉隨機啓動apache
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
開啓隨機啓動spa
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
啓動apacherest
sudo apachectl start
重啓apachecode
sudo apachectl restart
中止apacheip
sudo apachectl stop