I have a reverse proxy setup nginx host -> nagios both on ubuntu 20.04 machines virtual these are like just default apt-get install not customized. I added selfsigned certificate just for test.
192.168.254.107 - nginx 192.168.254.200 - nagios
The problem is that the cgi-bin seems not redirected and is being served on nginx itself
Nginx config
server {
listen 443 ssl;
listen 80 default_server;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 2m;
location /nagios4 {
proxy_pass https://192.168.254.200/nagios4;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
Error
2020/12/02 05:08:53 [error] 2307#2307: *21 open() "/usr/share/nginx/html/cgi-bin/nagios4/avail.cgi" failed (2: No such file or directory), client: 192.168.254.163, server: , request: "GET /cgi-bin/nagios4/avail.cgi HTTP/1.1", host: "192.168.254.107", referrer: "https://192.168.254.107/nagios4/side.php"
2020/12/02 05:08:58 [error] 2307#2307: *21 open() "/usr/share/nginx/html/cgi-bin/nagios4/extinfo.cgi" failed (2: No such file or directory), client: 192.168.254.163, server: , request: "GET /cgi-bin/nagios4/extinfo.cgi?type=3 HTTP/1.1", host: "192.168.254.107", referrer: "https://192.168.254.107/nagios4/side.php"
2020/12/02 05:09:02 [error] 2307#2307: *21 open() "/usr/share/nginx/html/cgi-bin/nagios4/extinfo.cgi" failed (2: No such file or directory), client: 192.168.254.163, server: , request: "GET /cgi-bin/nagios4/extinfo.cgi?type=6 HTTP/1.1", host: "192.168.254.107", referrer: "https://192.168.254.107/nagios4/side.php"
2020/12/02 05:09:02 [error] 2307#2307: *21 open() "/usr/share/nginx/html/cgi-bin/nagios4/extinfo.cgi" failed (2: No such file or directory), client: 192.168.254.163, server: , request: "GET /cgi-bin/nagios4/extinfo.cgi?type=0 HTTP/1.1", host: "192.168.254.107", referrer: "https://192.168.254.107/nagios4/side.php"
2020/12/02 05:09:03 [error] 2307#2307: *21 open() "/usr/share/nginx/html/cgi-bin/nagios4/extinfo.cgi" failed (2: No such file or directory), client: 192.168.254.163, server: , request: "GET /cgi-bin/nagios4/extinfo.cgi?type=4 HTTP/1.1", host: "192.168.254.107", referrer: "https://192.168.254.107/nagios4/side.php"
I noticed this when i tried open in another browser it goes and looks for the path on the nginx host...
https://192.168.254.107/cgi-bin/nagios4/status.cgi?hostgroup=all&style=hostdetail