Broken CSS and image path in CGI scripts

David Banks david.banks at proporta.com
Wed Feb 25 10:52:35 CET 2009


Hi nagios-users,

I recently upgraded a server from Nagios 2 to 3.  The upgrade was pretty 
smooth, I followed the upgrade guide from the website: make some 
configuration changes, configure, make all, make install.  The nagios 
install lives in /var/www/nagios.  (We use a virtual host for nagios, 
hence the /cgi-bin below.)  The configuration is below:

./configure --prefix=/var/www/nagios --with-cgiurl=/cgi-bin 
--with-nagios-user=nagios --with-nagios-group=nagios 
--with-command-group=nagcmd

I'm not sure how much of this is necessary with Nagios3 but this was the 
one we used with Nagios2.  In any case, everything went smooth, except 
that out of the box when I tried to access the 'Tactical Overview' or 
any of the CGI scripts, the CSS and image paths would be broken.

Looking at the source would reveal lines like this:

<LINK REL='stylesheet' TYPE='text/css' HREF='common.css'>

Since the CGI is executing at /cgi-bin/tac.cgi, this will cause the 
browser to request /cgi-bin/common.css, which is obviously incorrect. 
Nagios 2 had the absolute path here: /stylesheets/common.css which works 
fine.  (It's an empty file but it does exist.)  That's only an example, 
the problem happens for all CSS and images.

I have eventually either fixed or hacked around this by making the 
following configuration change in 'cgi.cfg':

url_html_path=/

This causes everything to load fine and the stylesheets to be referenced 
with an absolute path.  Is this right?  It seems like a hack, but I 
can't figure out what the right way to deal with this is.

Incidentally, these people look like they had the same problem, but 
neither of them posted their solution:

https://lists.ubuntu.com/archives/ubuntu-server-bugs/2008-September/006005.html
http://www.mail-archive.com/nagios-users@lists.sourceforge.net/msg13196.html

Running Nagios 3.06 on Ubuntu Hardy.

Thanks,
David

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list