Mac 1024 以下的端口为特权端口,只有 root 用户才有权监听。因此,要在 mac 上使用 Web 服务软件监听 80 或 443 端口,要么以 root 用户启动应用程序,要么使用端口转发。但是项目常用到443和80这两个低端口,使用nginx反向代理使用低端口。
Nginx配置:
1.使用brew install nginx
错误情况:如果之前没安装过homebrew,那么先安装
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
当Installation successful,则安装Homebrew成功。
-------------------------已经有Homebrew-------------那么
brew install nginx
安装好了执行nginx启动
brew services start nginx
successfully则安装nginx成功,mac中nginx貌似开始是默认使用8080的,这时候你localhost:8080就看到
则配置成功。
错误情况:如果没有显示,那么需要配一下环境变量
vim ~/.bash_profile
然后重新加载变量
source .bash_profile
成功!正式使用https://blog.csdn.net/one_hwx/article/details/86494888