502 网关错误 graylog

502 网关错误 graylog

我正在使用 nginx 作为反向代理。graylog uri conf

graylog.conf

rest_listen_uri= http://127.0.0.1:9000/
rest_transport_uri = http://192.168.1.1:9000/api/

nginx.conf

server {
      server_name graylog.example.in;
      listen      80 default_server;

      return 301 https://$server_name$request_uri;

    }

    server {

      server_name graylog.example.in;
      listen      443 ssl;



      location / {
            proxy_set_header    Host $http_host;
            proxy_set_header    X-Forwarded-Host $host;
            proxy_set_header    X-Forwarded-Server $host;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header    X-Graylog-Server-URL https://graylog.example.in/api;
            proxy_pass          http://127.0.0.1:9000;
      }

     #location /api/ {
      #      proxy_set_header    Host $http_host;
       #     proxy_set_header    X-Forwarded-Host $host;
        #    proxy_set_header    X-Forwarded-Server $host;
         #  proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
         # proxy_pass          http://127.0.0.1:12219/;
      #}
    }

我从 nginx 日志中收到错误

91#0: *1148 connect() failed (111: Connection refused) while connecting to upstream,

nginx 日志 2017/03/08 23:57:11 [错误] 1194#0:*3 connect()连接到上游时失败(111:连接被拒绝),客户端:137.97.3.237,服务器:,请求:“POST /api/cluster/metrics/multiple HTTP/1.1”,上游:“http://127.0.0.1:9000/api/cluster/metrics/multipl

答案1

这是我的

灰树

web_listen_uri = http://0.0.0.0:9000/
rest_listen_uri = http://0.0.0.0:12900/
rest_transport_uri = http://127.0.0.1:12900/

nginx

    location / {
    proxy_http_version 1.1;
    proxy_set_header X-Graylog-Server-URL https://graylog.example.com/api;
    proxy_pass http://127.0.0.1:9000;
}
location /api/ {
proxy_http_version 1.1;
proxy_pass http://127.0.0.1:12900/;

相关内容