server {
    server_name     nagios.your-domain.com;
    root            /usr/share/nagios/html;
    listen          80;
    index           index.php index.html index.htm;
    access_log      /var/log/nginx/nagios.access.log;
    error_log       /var/log/nginx/nagios.error.log;    auth_basic            "Nagios Access";
    auth_basic_user_file  /etc/nagios/private/htpasswd.users;
    add_header X-Frame-Options "ALLOW";    location ~ \.php$ {
        try_files       $uri = 404;
        fastcgi_index   index.php;
        fastcgi_pass    unix:/run/php/php7.4-fpm.sock;
        include         fastcgi.conf;
    }    location ~ \.cgi$ {
        root            /usr/lib64/nagios/cgi-bin;
        rewrite         ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
        fastcgi_param   AUTH_USER $remote_user;
        fastcgi_param   REMOTE_USER $remote_user;
        include         fastcgi.conf;
        fastcgi_pass    unix:/run/fcgiwrap.socket;
    }    # Fixes the fact some links are expected to resolve to /nagios, see here.
    location /nagios {
        alias /usr/share/nagios/html;
    }}
