nginx作为具有api端点的udp反向代理

时间:2017-11-26 19:54:55

标签: nginx config nginx-reverse-proxy

如何为DNS负载平衡和使用ReST-API创建/etc/nginx/nginx.conf?但负载平衡工作正常。但是创建api端点并不像我想象的那样起作用。

当我尝试启动该服务时,它失败并显示以下错误消息:

  

" nginx:[emerg]未知指令" api"在/etc/nginx/nginx.conf:27"。

到目前为止我的配置文件:

stream {
  upstream dns_servers {
    server 127.0.0.2:53 max_fails=3 fail_timeout=30s;
    server 127.0.0.3:53 max_fails=3 fail_timeout=30s;
  }
  server {
    listen 53 udp;
    proxy_pass dns_servers;
  }
}
http {
  server {
    listen 80;
    location /api {
      api write=on;
      allow 127.0.0.1;
      deny  all;
    }
  }
}

0 个答案:

没有答案