Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
zeotech
Posts: 4 Joined: Thu Nov 19, 2020 3:19 am
Post
by zeotech » Thu Nov 19, 2020 3:28 am
I am running this command
Code: Select all
curl -s -S http://nagios.example.com/nagios/cgi-bin/cmd.cgi -u nagiosadmin:nagios -d "cmd_typ=22&host=localhost&service=SSH"
when I run the command I get;
Code: Select all
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.17.8</center>
</body>
</html>
[Environmental Information]
OS: CentOS Linux release 8.2.2004 (Core)
WebServer: nginx version: nginx/1.17.8
Nagios: Ver 4.4.6
Is there any solution?
zeotech
Posts: 4 Joined: Thu Nov 19, 2020 3:19 am
Post
by zeotech » Thu Nov 19, 2020 8:05 pm
I've solved it myself.
Modified nginx.conf as follows
Code: Select all
location ~ \.cgi$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_split_path_info ^/nagios/cgi-bin/(.+\.cgi)(.*)$;
fastcgi_param CONTENT_LENGTH $content_length; ←This added.
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME /var/home/lib/nagios446/sbin/$fastcgi_script_name;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param AUTH_USER $remote_user;
auth_basic "Nagios Access";
auth_basic_user_file /var/home/lib/nagios446/etc/htpasswd.users;
}
Is this correct?