0

I am trying to set up xymon with nginx on debian, and I have the initial setup done.

However, whenever I hit a cgi script I will get a 403 error.

Here is my setup:

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;
       }
}

I have tried to adapt it from this freeBSD setup her: https://blog.feld.me/posts/2014/11/setting-up-xymon-with-nginx/

I get little unhelpful logs: 127.0.0.1 - - [08/Jan/2017:00:25:14 +0100] "GET /cgi-bin/findhost.sh HTTP/1.1" 403 25

Has anyone setup xymon on debian with nginx and got it working?

mahatmanich
  • 2,954
  • 3
  • 22
  • 23

1 Answers1

0

Ok so I managed to fix it!

This is the correct setup for 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;
       }
}
mahatmanich
  • 2,954
  • 3
  • 22
  • 23