Question

Nginx not running

Posted September 22, 2019 553 views
NginxDigitalOcean

Hi all,

I have a FreeIPA server(centos 7:hostname=ipa.5ghvl.local) and 2 clients.My client add FreeIPA Domain 5ghvl.local.

I want ELK Stack for IPA server and clients monitoring.I reference https://github.com/mzamora9913/Collecting-Syslogs-from-FreeIPA-and-clients-using-ELK-Stack/blob/master/Elkmarkdown.md.

ELK stack adding freeipa domain.

ELK Stack

hostname:elkstack.5ghvl.local

IP:10.154.7.30/24

gw:10.154.7.1

DNS:

search 5ghvl.local
nameserver 10.154.7.21

IPA SERVER

hostname:ipa.5ghvl.local

IP:10.154.7.21/24

gw:10.154.7.1

DNS:10.150.0.5

$ sudo vi /etc/nginx/nginx.conf

#server         <-- from here 
#{
#...
#...
#}      <-- to here

Below config server_name is it right?

I don’t sure config.

$ sudo vi /etc/nginx/conf.d/kibana.conf

server {

listen 80;

server_name ipa.5ghvl.local; 
    # to add additional authentication uncomment the two bellow
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.users;

    location / {
            proxy_pass http://localhost:5601;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;        
    }
}

on browser ;htpp://10.154.7.30

Kibana is not running and nginx 502 bad gateway.

[root@elkstack ~]# sestatus
SELinux status:                 disabled

I don’t running ;$ sudo setsebool -P httpdcannetwork_connect 1 because selinux is disabled.

Nginx log;

 server: ipa.5ghvl.local, request: "GET /favicon.ico HTTP/1.1", upstream: "http://localhost/favicon.ico", host: "10.154.7.30", referrer: "http://10.154.7.30/"
2019/09/22 15:34:41 [error] 22023#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 10.154.22.15, server: ipa.5ghvl.local, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5601/", host: "10.154.7.30"
2019/09/22 15:34:41 [error] 22023#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 10.154.22.15, server: ipa.5ghvl.local, request: "GET / HTTP/1.1", upstream: "http://[::1]:5601/", host: "10.154.7.30"
edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hello, @nazancengiz

Can you confirm if nginx is running fine? You can also check the nginx configuration file for any syntax errors using:

nginx -t

Looking forward to your reply.

  • Hello,
    [hvl@elk kibana]$ sudo nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

There are no syntax errors in the nginx config file which is good. Can you check the nginx error log for additional information?

/var/log/nginx/error.log

You can make sure which is the exact log by simply checking the conf file:

grep error_log /etc/nginx/nginx.conf

Let me know how it goes.

Submit an Answer