1.确定mac是否安装了brew,直接输入brew命令,看见返回信息,就说明已经安装了
brew常用的命令:
brew search mysql : 搜索具体的程序包
brew install mysql : 安装具体的程序包
brew info mysql : 查看具体程序的信息
brew uninstall mysql : 卸载具体的应用(这里只是用mysql 作个例子)
2.命令 brew install nginx
3.启动nginx , sudo nginx start,打开localhost:8080 会弹出 welcome to nginx 界面
nginx常用命令:
nginx -s quit 退出
nginx -s reload 重新加载
nginx -t 测试nginx.conf配置
在此要记住这几个文件目录:
/usr/local/cellar
/usr/local/etc/nginx
/usr/local/var
#跨域配置
进入到 /usr/local/etc/nginx 下修改nginx.conf文件
#add_header Access-Control-Allow-Origin *;
#add_header Access-Control-Allow-Headers X-Requested-With;
#add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
server {
listen 8000;
location /r168 {
rewrite ^.+r168/?(.*)$ /$1 break;
include uwsgi_params;
proxy_pass http://192.168.114.74:8080/;
}
}