Mac下安装nginx
brew intstall nginx  | 
编辑配置
/usr/local/etc/nginx/nginx.conf  | 
配置日志目录
新建日志目录
在/usr/local/etc/nginx目录下新建logs目录mkdir logs
在
/usr/local/etc/nginx/nginx.conf中配置日志路径error_log /usr/local/etc/nginx/logs/error.log;
access_log /usr/local/etc/nginx/logs/access.log main;
验证配置
nginx -t  | 
查看版本
nginx -v  | 
启动
nginx  | 
访问
http://localhost:8080  | 
查看进程
ps -ef|grep nginx  | 
关闭进程
pkill -9 nginx  | 
重启
nginx -s reload  | 
停止
nginx -s stop  | 
路由配置
listen 8080;  | 
这是一个SPA项目重构的配置,新版与老版兼容共存,使用同一个域名访问,nginx根据路径响应不同的SPA应用主页面
当用户访问 http://localhost:8080 时,访问 crm-web/dist 下的 index.html
当用户访问 http://localhost:8080/v2 时,访问 crm-web-v2/dist 下的 index.html
MAC 查看端口占用
lsof -i:8080  | 
MAC 关闭进程
kill -g PID  |