美文网首页
Mac 安装nginx

Mac 安装nginx

作者: OPice | 来源:发表于2019-11-22 18:15 被阅读0次

    使用brew安装

    brew install nginx 
    

    安装中出现的brew问题

    安装成功后

    nginx -s reload|reopen| stop|quit|  重新加载配置|重启|停止|推出
    

    修改nginx.conf

    server {
         listen 80;      # 监听的端口号
         server_name www.XXX.com;     # 服务器名称
         client_max_body_size 100m;   # 定义读取客户端请求头的超时时间
         location / {
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header Host  $http_host;
              proxy_set_header X-Nginx-Proxy true;
              proxy_set_header Connection "";
              proxy_pass     http://这里是要映射的服务地址;
        }
    }
    

    相关问题处理
    查看端口占用: lsof -i: 端口 kill -9 PID

    相关文章

      网友评论

          本文标题:Mac 安装nginx

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