- brew install nginx
提示没有权限
Error: The following directories are not writable by your user:
/usr/local/include
/usr/local/lib
2.sudo brew install nginx
提示不支持
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
3.加权限 sudo chown -R $(whoami) /usr/local
提示当前操作系统不支持
chown: /usr/local: Operation not permitted
- stackoverflow 查到 sudo chown -R (brew --prefix)/*
sudo chown -R mac brew
brew install nginx
成功!
配置
譬如微信登陆,重定向
/usr/local/etc/nginx
server {
listen 80
}
server {
listen 80;
server_name xx.xx.com; //①这里指定需要重定向的域名
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://localhost:8080; //②这里指向本地
root html;
index index.html index.htm;
}
}
reload nginx
sudo nginx -s reload
stop nginx
sudo nginx -s stop
references
https://coderwall.com/p/dgwwuq/installing-nginx-in-mac-os-x-maverick-with-homebrew
https://github.com/Homebrew/brew/issues/3228