Skip to content
This repository has been archived by the owner. It is now read-only.

[dev.icinga.com #2253] add example configs for alternate webservers like nginx or lighttpd #843

Closed
icinga-migration opened this issue Jan 6, 2012 · 18 comments

Comments

Projects
None yet
1 participant
@icinga-migration
Copy link
Member

commented Jan 6, 2012

This issue has been migrated from Redmine: https://dev.icinga.com/issues/2253

Created by mfriedrich on 2012-01-06 10:42:04 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2013-03-11 20:29:04 +00:00)
Target Version: 1.9
Last Update: 2014-12-08 09:32:56 +00:00 (in Redmine)


like https://wiki.icinga.org/display/howtos/Setting+up+Icinga+with+Nginx provides, it will be useful to provide such example configs directly within icinga tarball.

this will requires the community to help test and verify those

  • nginx
  • lighttpd

Attachments

  • icinga.tar.gz fmbiete - 2012-10-01 15:10:02 +00:00 - Icinga Classic Ui Nginx configuration
  • icinga-web.tar.gz fmbiete - 2012-10-01 15:21:58 +00:00 - Icinga-Web Nginx configuration

Changesets

2012-10-03 17:07:35 +00:00 by mfriedrich f976609

contrib: add nginx configuration for icinga classicui by Francisco Miguel Biete into contrib/nginx #2253 - MF

this is just an import from https://dev.icinga.org/issues/2253
please contact francisco directly on questions.

refs #2253

2013-03-11 20:28:10 +00:00 by (unknown) bae9541

install: add lighttp config samples to contrib/lighttp refs #2253
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Feb 1, 2012

Updated by ricardo on 2012-02-01 09:27:32 +00:00

Hi,

this is how I got it working well

server {
        listen *:80;
        server_name icinga;
        error_log /var/log/nginx/icinga.log warn;
        root /var/www/localhost/htdocs/;
        index   index.php index.html;

        location / {
                index           index.html;
        }

        location /icinga {
                alias   /opt/icinga/share;
                index  index.html;

                auth_basic              "Icinga";
                auth_basic_user_file    icinga.users;
        }


        location ~ \.cgi$ {
                root    /opt/icinga/sbin/;
                rewrite ^/icinga/cgi-bin/(.*)\.cgi /$1.cgi break;

                include /etc/nginx/fastcgi_params;

                fastcgi_pass   127.0.0.1:49233;

                auth_basic              "Icinga Access";
                auth_basic_user_file    icinga.users;

                fastcgi_param  AUTH_USER          $remote_user;
                fastcgi_param  REMOTE_USER        $remote_user;
        }

        # include pnp4nagios
        include /opt/icinga/pnp/etc/nginx.pnp4nagios.conf;
}

Have a look at http://wiki.nginx.org/Fcgiwrap for a fastCGI Wrapper.

to launch the wrapper i used "spawn-fcgi"

FCGI_SOCKET=
FCGI_ADDRESS=127.0.0.1
FCGI_PORT=49233
FCGI_PROGRAM=/usr/bin/fcgiwrap
FCGI_CHILDREN=1
FCGI_CHROOT=
FCGI_CHDIR=
FCGI_USER=nginx
FCGI_GROUP=nginx
ALLOWED_ENV="PATH"

If you want to use pnp4nagios you will also need a spawn-cgi for php. have a look at http://wiki.nginx.org/PHPFcgiExample .

pnp4nagios has a configuration file already included in sources.

Hope this helps

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented May 5, 2012

Updated by mfriedrich on 2012-05-05 11:46:45 +00:00

  • Status changed from New to Feedback
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jul 20, 2012

Updated by fmbiete on 2012-07-20 16:38:36 +00:00

That configuration works fine, but I modified it a little.

icinga.vhost

server {
listen 80;
server_name icinga.domain.com;
index index.php index.html index.htm;
include nginx.security.conf;
include nginx.icinga.conf;
include nginx.pnp4nagios.conf;
}

nginx.security.conf

#Basic Security
location = /favicon.ico {
log_not_found off;
access_log off;
expires max;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
#Deny access to hidden files (.htaccess)
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

nginx.icinga.conf

#Icinga Classic - Configuration
location /icinga {
alias /usr/local/icinga/share;
index index.html;
auth_basic "Icinga Access";
auth_basic_user_file /usr/local/icinga/etc/htpasswd.users;
}
#Only /icinga/*.cgi
location ~ /icinga/(.*)\.cgi$ {
root /usr/local/icinga/sbin;
rewrite ^/icinga/cgi-bin/(.*)\.cgi /$1.cgi break;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
auth_basic "Icinga Access";
auth_basic_user_file /usr/local/icinga/etc/htpasswd.users;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}

nginx.pnp4nagios.conf

location /pnp4nagios {
alias /usr/local/pnp4nagios/share;
index index.php;
try_files $uri $uri/ pnp4nagios; } location pnp4nagios {
#I need to add this rewrite, otherwise I have URI like "pnp4nagios/graph" and it gives 404 error
if ( $uri !~ /pnp4nagios/index.php(.*)) {
rewrite ^/pnp4nagios/(.*)$ /pnp4nagios/index.php/$1;
break;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
#this splits out the trailing path
#eg index.php?host -> $fastcgi_path_info == 'host'
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME /usr/local/pnp4nagios/share/index.php;
}
@

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jul 20, 2012

Updated by fmbiete on 2012-07-20 16:43:09 +00:00

You will need the following software:

Nginx
FastCGI Wrapper
PHP-FPM and PHP-ACP (optional)

apt-get install nginx fcgiwrap php-apc php5-fpm

In Debian 6 (Squeeze) you will need to add the dotdeb.org repo, since pnp5-fpm is not included and the versions are pretty old.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Sep 24, 2012

Updated by mfriedrich on 2012-09-24 10:44:52 +00:00

can you create a small tarball with all needed files, plus an extended README for all nginx users out there, plus mentioning you as author? i am willing to put this straight into contrib/nginx but i need a confirmation on author and working functionality.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 1, 2012

Updated by fmbiete on 2012-10-01 15:10:02 +00:00

  • File added icinga.tar.gz

It's my working configuration, removing my server_name.
In the tarball there is a README with requirements, basic instructions and full instructions for a Debian 6 system.

Feel free to use or redistribute them.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 1, 2012

Updated by fmbiete on 2012-10-01 15:21:58 +00:00

  • File added icinga-web.tar.gz

Not sure if it would be better to open a new ticket, since it's not icinga classic ui but icinga-web...
but here is the icinga-web config for nginx.

If you prefer a new ticket in the icinga-web, tell me and I will open it.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 1, 2012

Updated by mfriedrich on 2012-10-01 17:07:41 +00:00

  • Assigned to set to mfriedrich

thanks, i guess when we put that into contrib/ everyone should be lucky then.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 2, 2012

Updated by mfriedrich on 2012-10-02 20:09:21 +00:00

  • Status changed from Feedback to Assigned
  • Target Version set to 1.8
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 3, 2012

Updated by mfriedrich on 2012-10-03 17:59:57 +00:00

  • Target Version changed from 1.8 to 1.9
  • Done % changed from 0 to 50

thanks - added both to core and web, plus updated the wiki entry. now, the other 50% should be doable with lighttp - anyone?

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 4, 2012

Updated by fmbiete on 2012-10-04 14:45:31 +00:00

You could update the wiki entry for icinga-web:
https://wiki.icinga.org/display/howtos/Setting+Up+Icinga+Web+with+Nginx

Sorry, I cannot help with the lighttpd part :P

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 4, 2012

Updated by mfriedrich on 2012-10-04 14:50:44 +00:00

ah forgot that one, thx.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 4, 2012

Updated by ricardo on 2012-10-04 14:53:29 +00:00

gentoo has a config for icinga with lighttpd

untested:

more /usr/portage/net-analyzer/icinga/files/icinga-lighty.conf 
server.modules += ("mod_cgi")
server.modules += ("mod_auth")
server.modules += ("mod_alias")

auth.require += ( "/icinga" =>
        (
                "method"  => "digest",
                "realm"   => "icinga",
                "require" => "valid-user"
        )
)

$HTTP["url"] =~ "^/icinga/cgi-bin/" {
        dir-listing.activate = "disable"
        cgi.assign = (
                ".pl"  => "/usr/bin/perl",
                ".cgi" => ""
        )
}

alias.url += (
        "/icinga/cgi-bin" => "/usr/lib/icinga/cgi-bin",
        "/icinga"         => "/usr/share/icinga/htdocs"
)

and:

                        elif use lighttpd ; then
                                elog "  usermod -G icinga lighttpd "
                                elog "or"
                                elog "  chown icinga:lighttpd /etc/icinga"
                                elog "Also edit /etc/lighttpd/lighttpd.conf and add 'include \"lighttpd_icinga.conf\"'"
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 4, 2012

Updated by mthode on 2012-10-04 15:59:45 +00:00

If I remove the .pl line from the gentoo one (doesn't seem needed) can we use that?

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 4, 2012

Updated by ricardo on 2012-10-04 20:09:26 +00:00

so, tested this one and it works very well.

/etc/lighttpd/lighttpd_icinga.conf

server.modules += ("mod_cgi")
server.modules += ("mod_auth")
server.modules += ("mod_alias")
server.modules += ("mod_setenv")


$HTTP["url"] =~ "^/icinga/cgi-bin/" {
        dir-listing.activate = "disable" 
        cgi.assign = ( ".cgi" => "" )
}

$HTTP["url"] =~ "^/icinga/" {
        auth.backend = "htpasswd"
        auth.backend.htpasswd.userfile = "/usr/local/icinga/etc/htpasswd.users"
        auth.require += ( "" =>
                (
                        "method"  => "basic",
                        "realm"   => "Icinga Access",
                        "require" => "valid-user"
                )
        )
        setenv.add-environment = ( "REMOTE_USER" => "user" )
}

alias.url += (
        "/icinga/cgi-bin" => "/usr/local/icinga/sbin",
        "/icinga"         => "/usr/local/icinga/share" 
)

and add this to /etc/lighttpd/lighttpd.conf

include "/etc/lighttpd/lighttpd_icinga.conf"

Done

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Dec 20, 2012

Updated by ricardo on 2012-12-20 17:18:10 +00:00

can we include the lighted somehow?

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Mar 11, 2013

Updated by mfriedrich on 2013-03-11 20:29:04 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 50 to 100

added to contrib/lighttp

therefore resolving this now. if there's anything else, comment here and i'll reopen the issue.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Dec 8, 2014

Updated by mfriedrich on 2014-12-08 09:32:56 +00:00

  • Project changed from 19 to Core, Classic UI, IDOUtils
  • Category set to Classic UI
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.