选择2 - 单独端口上的 REST API 和 Web 界面(使用 HTTP):

确保服务器 Graylog 配置文件 server.conf 具有以下设置:

  • rest_listen_uri = http://your_public_ip:12900/
  • web_listen_uri = http://your_public_ip:9000/

确保 nginx 块具有以下内容:

server
{
  listen      80 default_server;
  listen      [::]:80 default_server ipv6only=on;
  server_name graylog.onitroad.local;
  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 http://graylog.onitroad.local/api;
        proxy_pass          http://your_public_ip: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://your_public_ip:12900/;
}
如何将 nginx 配置为 Graylog2 服务器的反向代理

在本教程中,我们将解释如何将 Nginx 配置为 Graylog 2 服务器的反向代理。

从 Graylog 2.1 开始,在公开其 Web 界面时,我们有两种选择:

  • 在同一个端口上运行,使用不同的路径(对于 REST API 默认为 http://localhost:9000/api/,对于 Web 界面默认为 http://localhost:9000/),这是默认的
  • 在两个不同的端口上运行(例如 http://localhost:12900/用于 REST API 和 http://localhost:9000/用于 Web 界面)

Graylog Server Web 界面和 REST API 可以在单个端口 9000 或者单独的端口(12900 和 9000)中运行。

选择1 - 一个端口上的 REST API 和 Web 界面(使用 HTTP):

确保服务器 Graylog 配置文件 server.conf 具有以下设置:

  • rest_listen_uri = http://your_public_ip:9000/api/
  • web_listen_uri = http://your_public_ip:9000/

确保 nginx 块具有以下内容:

server
{
  listen      80 default_server;
  listen      [::]:80 default_server ipv6only=on;
  server_name graylog.onitroad.local;
  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 http://graylog.onitroad.local/api;
        proxy_pass          http://your_public_ip:9000;
    }
}

确保创建一个条目 dns 以访问 dns 服务器中的 Graylog Web 界面。

日期:2020-06-02 22:18:52 来源:oir作者:oir