3

I have been moving my nagios on apaches virtualhost and adding the following configuration file

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName  nagios.example.com
    ServerAlias nagios.example.com         
    DocumentRoot /usr/local/nagios/share
    ScriptAlias /cgi-bin/nagios /usr/local/nagios/sbin
    ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin 


    # Where the stylesheets (config files) reside
    #Alias /nagios/stylesheets /usr/local/nagios/share 

    # Where the HTML pages live
    Alias /nagios  /usr/local/nagios/share

    <Directory  /usr/local/nagios/share>
        Options FollowSymLinks
        DirectoryIndex index.php
        AllowOverride AuthConfig
        Order Allow,Deny
        Allow From All

        AuthName "Nagios Access"
        AuthType Basic
        AuthUserFile /etc/nagios3/htpasswd.users
        require valid-user
    </Directory>

    </VirtualHost>

When I browse the page I'm getting the following error: The requested URL /cgi-bin/tac.cgi was not found on this server. Checking the scriptaliases routes everything seems to be alright. Clicking inside of a menu the cgi problem do not persist, just on page browsing.

guntbert
  • 13,475
lgt
  • 185

3 Answers3

2

Your Configuration file looks alright just comment the line

Alias /nagios  /usr/local/nagios/share

Because you are already defining the DocumentRoot thus this line is making conflict with in your path defining for Nagios.

guntbert
  • 13,475
Swapnil
  • 21
0

I'm running Ubuntu 12.04 and in order to fix the initial tac.cgi error you have to edit a line in the index.html and index.php files to the following.

frame src="/nagios/cgi-bin/tac.cgi" name="main" />

After that the initial page will load correctly.

Seth
  • 59,332
Jason
  • 1
0

I'm not sure if this is 100% correct but it 100% works.

    <VirtualHost *:80>
    ServerName nagios.example.org
    ServerAlias nagios
    ServerAdmin webmaster@example.org
    DocumentRoot /usr/local/nagios/share

    ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
    ScriptAlias /cgi-bin /usr/local/nagios/sbin
    Alias /nagios  /usr/local/nagios/share

    <Directory /usr/local/nagios/share>
            Options Indexes FollowSymLinks MultiViews
            #  SSLRequireSSL
            AllowOverride None
            Order allow,deny
            Allow from all
            #  Order deny,allow
            #  Deny from all
            #  Allow from 127.0.0.1
            AuthName "Nagios Access"
            AuthType Basic
            AuthUserFile /usr/local/nagios/etc/htpasswd.users
            Require valid-user
    </Directory>

    <Directory "/usr/local/nagios/sbin">
            #  SSLRequireSSL
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            AllowOverride None
            Order allow,deny
            Allow from all
            #  Order deny,allow
            #  Deny from all
            #  Allow from 127.0.0.1
            AuthName "Nagios Access"
            AuthType Basic
            AuthUserFile /usr/local/nagios/etc/htpasswd.users
            Require valid-user
    </Directory>

    ErrorLog /var/log/httpd/nagios_error.log

    LogLevel warn

    CustomLog /var/log/httpd/nagios_access.log combined
    ServerSignature On
    </VirtualHost>

I found this layout after researching and combining numerous methods. Any input would be appreciated as to why or why not this may be incorrect.