在 Debian 8 上安装 xymon 和 nginx 会导致 cgi 脚本出现 403 错误

在 Debian 8 上安装 xymon 和 nginx 会导致 cgi 脚本出现 403 错误

我正在尝试在 debian 上设置 xymon 和 nginx,并且已经完成初始设置。

但是,每当我点击 CGI 脚本时,我都会收到 403 错误。

这是我的设置:

server {
        listen 127.0.0.1:8081;

        server_name localhost;
        index       index.html;
        root        /var/lib/xymon/www;

        error_log /var/log/nginx/xymon.error.log;
        access_log /var/log/nginx/xymon.access.log;

        location /xymon/ {
                alias /var/lib/xymon/www/;
        }

        location /cgi-bin/ {
                alias /usr/lib/xymon/cgi-bin/;
        }

        location /cgi-secure/ {
                alias  /usr/lib/xymon/cgi-secure/;
        }

       location ~ ^/.*\.sh$ {
                gzip off;
                fastcgi_param SCRIPT_NAME $fastcgi_script_name;
                fastcgi_param DOCUMENT_ROOT /var/lib/xymon/;
                fastcgi_param REMOTE_USER $remote_user;
                include fastcgi_params;
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
       }
}

我尝试从这个 freeBSD 设置中调整它: https://blog.feld.me/posts/2014/11/setting-up-xymon-with-nginx/

我收到了一些没用的日志:127.0.0.1 - - [08/Jan/2017:00:25:14 +0100] "GET /cgi-bin/findhost.sh HTTP/1.1" 403 25

有人在 debian 上使用 nginx 设置 xymon 并让它运行吗?

答案1

好的,我成功修复了它!

这是 debian 的正确设置:

server {
        listen 127.0.0.1:8081;

        server_name localhost;
        index       index.html;
        root        /usr/lib/xymon/server/www;

        error_log /var/log/nginx/xymon.error.log;
        access_log /var/log/nginx/xymon.access.log;

        location /xymon/ {
                alias /usr/lib/xymon/server/www/;
        }

        location /cgi-bin/ {
                alias /usr/lib/xymon/cgi-bin/;
        }

        location /cgi-secure/ {
                alias  /usr/lib/xymon/cgi-secure/;
        }

       location ~ ^/.*\.sh$ {
                gzip off;
                fastcgi_param SCRIPT_NAME $fastcgi_script_name;
                fastcgi_param DOCUMENT_ROOT /usr/lib/xymon/;
                fastcgi_param REMOTE_USER $remote_user;
                include fastcgi_params;
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
       }
}

相关内容