Setting up Xymon with Nginx

Thu 06 November 2014 by feld

Xymon has been a favorite monitoring tool of mine for quite some time now largely due to its simplicity and flexibility. However, I despise running Apache unless absoultely neccessary. Previous attempts at getting Nginx and Xymon to play nice were not successful without some lazy hacks, but I finally sat down and made it work as cleanly as possible. See the below Nginx config. You may have to make minor adjustments if you're not on FreeBSD.

server {
        listen 80;
        listen [::]:80;
        index   index.html;
        root /usr/local/www/xymon/server/www;

        location /xymon/ {
                alias /usr/local/www/xymon/server/www/;

        location /cgi-bin/ {
                alias  /usr/local/www/xymon/cgi-bin/;

        location /cgi-secure/ {
                alias  /usr/local/www/xymon/cgi-secure/;

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

Upstream Xymon supplies an Apache configuration that aliases /xymon-cgi/ to /cgi-bin/ and /xymon-seccgi/ to /cgi-secure/. Due to the way that Nginx handles aliases and fastcgi SCRIPT_NAME we don't have much choice here. We're just going to use them exactly as they're named on the filesystem and adjust Xymon to play along.

Change the following in your xymonserver.cfg:


Now you should have a fully functional Xymon interface served by Nginx. I strongly suggest you protect the Xymon interface or at least the /cgi-secure/ with a password, though. I'll leave that up to the reader.