# [solved]Nagios on Apache2 opening, not running, CGI files

## FcukThisGame

I've been following the Gentoo nagios guide, but I'm having an issue with cgi files. When I click links in Nagios it tries to open the respective .cgi file, rather than running its code.

What do I need to do to make it run the code?

----------

## FcukThisGame

Bump with info:

```

gentoo ~ # confcat /etc/conf.d/apache2

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D PHP5 -D SUEXEC"

gentoo ~ # confcat /etc/apache2/httpd.conf

ServerRoot "/usr/lib/apache2"

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule cgi_module modules/mod_cgi.so

LoadModule cgid_module modules/mod_cgid.so

LoadModule dir_module modules/mod_dir.so

<IfDefine INFO>

LoadModule info_module modules/mod_info.so

</IfDefine>

LoadModule mime_module modules/mod_mime.so

<IfDefine SSL>

LoadModule ssl_module modules/mod_ssl.so

</IfDefine>

<IfDefine USERDIR>

LoadModule userdir_module modules/mod_userdir.so

</IfDefine>

User apache

Group apache

Listen 80

NameVirtualHost *:80

Include /etc/apache2/modules.d/*.conf

Include /etc/apache2/vhosts.d/*.conf

```

I can post my vhosts if necessary... When accessing my.site/nagios it loads, but when i load a CGI page it just tries to download the file.

----------

## magic919

Might be worth showing the part of the Apache vhost config where you define the Nagios stuff.

----------

## FcukThisGame

```
<VirtualHost *:80>

       ServerName status.<myname>.org

       ServerAlias status.<myname>.org

       ServerAdmin <myemail>

       DocumentRoot "/var/www/<myname>.org/nagios"

        <Directory "/var/www/<myname>.org/nagios">

               Options Indexes FollowSymLinks

               AllowOverride All

               Options +ExecCGI

               Order allow,deny

               Allow from all

       </Directory>

       <Directory "/usr/lib/nagios/cgi-bin">

                Options Indexes FollowSymLinks

                AllowOverride All

                Options +ExecCGI

                Order allow,deny

                Allow from all

        </Directory>

        </VirtualHost>

```

----------

## FcukThisGame

Solved. cgi.cfg needed to be configured.

----------

## magic919

Now enjoy monitoring!

----------

## libin0410

can you tell me how to configure cgi.cfg ?

----------

## magic919

You should see how when you start editing it.  Start a new thread if you get stuck.

----------

