Nginx proxy not working correct

Apologies if this is very basic.

I’m struggling to get my graylog running corectly with nginx proxy.

I want to access graylog from my headless server.

My setup is as follow:

graylog server.conf
rest_listen_uri =127.0.0.1:9000/api/
web_listen_uri =127.0.0.1:9000/

HTTP included as I can’t post it.
My nginx setup is exactly as the guide:
web_interface.html#webif-connecting-to-server

I’m receiving a error were once graylog opens, it gives an issue that can’t access http://127.0.0.1/api/

you might have only one setting that is not working correctly

server
{
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    server_name graylog.example.org;

    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://$server_name/api;
      proxy_pass       http://127.0.0.1:9000;
    }
}

the above configuration need to be on the Graylog server where the NGINX is running too. The server_name need to be set to the FQDN and if you connect to an IP and not the Hostname you need to adjust the line with X-Graylog-Server-URL and remove $server_name and place the IP in that.

1 Like

Thank you so much JAN!! It works!
I’ve changed the X-Graylog-Server-URL to my local IP and we are in business!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.