美文网首页
mac 安装 nginx

mac 安装 nginx

作者: Pupuu | 来源:发表于2018-11-20 16:50 被阅读0次
    1. 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
    
    1. stackoverflow 查到 sudo chown -R (whoami)(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

    相关文章

      网友评论

          本文标题:mac 安装 nginx

          本文链接:https://www.haomeiwen.com/subject/ttuxqqtx.html