下载安装Brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew又叫Homebrew,是Mac中的一款软件包管理工具,通过brew可以很方便的在Mac中安装软件或者是卸载软件.
一般Mac电脑会默认安装有brew.
常用指令如下:
brew search nginx
brew install nginx
brew uninstall nginx
sudo brew update
sudo brew info nginx
brew list
sudo brew install nginx
sudo brew services start nginx
http://localhost:8080
进行访问, 如果出现如下界面,说明启动成功nginx
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To have launchd start nginx now and restart at login:
brew services start nginx
Or, if you don‘t want/need a background service you can just run:
nginx
原文:https://www.cnblogs.com/Nyan-Workflow-FC/p/10614011.html