[icinga-checkins] icinga.org: icinga-core/master: contrib: add nginx configuration for icinga classicui by Francisco Miguel Biete into contrib /nginx #2253 - MF

git at icinga.org git at icinga.org
Wed Oct 3 19:58:19 CEST 2012


Module: icinga-core
Branch: master
Commit: f976609f7e8582de832173e49b4f077c930c2ed3
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=f976609f7e8582de832173e49b4f077c930c2ed3

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Wed Oct  3 19:07:35 2012 +0200

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

---

 Changelog                           |    2 +
 contrib/nginx/README.nginx          |   77 +++++++++++++++++++++++++++++++++++
 contrib/nginx/icinga-classic.vhost  |   17 ++++++++
 contrib/nginx/nginx.icinga.conf     |   21 +++++++++
 contrib/nginx/nginx.pnp4nagios.conf |   23 ++++++++++
 contrib/nginx/nginx.security.conf   |   19 +++++++++
 6 files changed, 159 insertions(+), 0 deletions(-)

diff --git a/Changelog b/Changelog
index feb9bf1..92de943 100644
--- a/Changelog
+++ b/Changelog
@@ -64,6 +64,8 @@ ENHANCEMENTS
 
 * install: add --with-mainurl to configure, allowing to set the main frame target url for index.html #2611 - MF
 
+* contrib: add nginx configuration for icinga classicui by Francisco Miguel Biete into contrib/nginx #2253 - MF
+
 * docs: add a new stylesheet and rework docbook.xsl #3046 - MF
 * docs: add tocs for all sections #3193 - WN
 
diff --git a/contrib/nginx/README.nginx b/contrib/nginx/README.nginx
new file mode 100644
index 0000000..1511116
--- /dev/null
+++ b/contrib/nginx/README.nginx
@@ -0,0 +1,77 @@
+REQUIREMENTS:
+=============
+
+PHP 5.3
+PHP-FPM 5.3 (PHP-APC Optional)
+FASTCGI WRAPPER
+NGINX 1.2 or newer
+
+INSTALLATION
+============
+- Install all the required packages from your distro repository.
+- Copy all the files to the configuration folder of nginx.
+- Include the icinga-classic.vhost as a nginx virtual host.
+- Restart nginx.
+
+
+DEBIAN EXAMPLE
+==============
+Enable the dotdeb repository to get the latest version of PHP and Nginx (http://www.dotdeb.org)
+# cat > /etc/apt/sources.list.d/dotdeb.list << EOF
+deb http://packages.dotdeb.org squeeze all
+deb-src http://packages.dotdeb.org squeeze all
+EOF
+
+Refresh the package list
+# apt-get update
+
+Upgrade the system
+# apt-get upgrade
+
+Install the required packages
+# apt-get install nginx php5-fpm php-apc fcgiwrap
+
+Configure to your taste the fpm and fcgiwrap config files (default values are almost safe)
+# vi /etc/php5/fpm/php-fpm.conf
+# vi /etc/php5/fpm/php.ini
+# vi /etc/php5/fpm/pool.d/www.conf
+
+Edit the FASTCGI WRAPPER init script, and change the user/group to your selected user:
+# vi /etc/init.d/fcgiwrap
+-FCGI_USER="www-data"
+-FCGI_GROUP="www-data"
++FCGI_USER="icinga"
++FCGI_GROUP="icinga"
+
+
+For more info check their docs.
+
+Copy the config file into the sites-available folder for nginx
+# cp icinga-classic.vhost nginx.icinga.conf nginx.pnp4nagios.conf nginx.security.conf /etc/nginx/sites-available
+
+Modify the icinga-classic.vhost to include the path to the .conf files
+# vi /etc/nginx/sites-available/icinga-classic.vhost
+-    include nginx.security.conf;
++    include /etc/nginx/sites-available/nginx.security.conf;
+
+-    include nginx.icinga.conf;
++    include /etc/nginx/sites-available/nginx.icinga.conf;
+
+-    include nginx.pnp4nagios.conf;
++    include /etc/nginx/sites-available/nginx.pnp4nagios.conf;
+
+Enable the virtual host for icinga classic
+# ln -s /etc/nginx/sites-available/icinga-classic.vhost /etc/nginx/sites-enabled/icinga-classic.vhost
+
+Change the user of nginx if needed
+# vi /etc/nginx/nginx.conf
+
++ user=icinga;
+
+Restart nginx
+# /etc/init.d/nginx restart
+
+
+Author
+======
+Francisco Miguel Biete <fmbiete at gmail dot com>
diff --git a/contrib/nginx/icinga-classic.vhost b/contrib/nginx/icinga-classic.vhost
new file mode 100644
index 0000000..57bc28a
--- /dev/null
+++ b/contrib/nginx/icinga-classic.vhost
@@ -0,0 +1,17 @@
+server {
+    listen 80;
+    server_name icinga.domain.com
+    index index.php index.html index.htm;
+
+    error_log /var/log/nginx/icinga-classic_error.log;
+
+    include nginx.security.conf;
+
+    include nginx.icinga.conf;
+
+    include nginx.pnp4nagios.conf;
+
+    location = / {
+        rewrite ^/$ /icinga/index.html permanent;
+    }
+}
diff --git a/contrib/nginx/nginx.icinga.conf b/contrib/nginx/nginx.icinga.conf
new file mode 100644
index 0000000..da10cd8
--- /dev/null
+++ b/contrib/nginx/nginx.icinga.conf
@@ -0,0 +1,21 @@
+# 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;
+    }
+
+    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;
+    }
+
diff --git a/contrib/nginx/nginx.pnp4nagios.conf b/contrib/nginx/nginx.pnp4nagios.conf
new file mode 100644
index 0000000..3b65375
--- /dev/null
+++ b/contrib/nginx/nginx.pnp4nagios.conf
@@ -0,0 +1,23 @@
+# PNP4Nagios Configuration
+location /pnp4nagios {
+    alias /usr/local/pnp4nagios/share;
+    index index.php;
+    try_files $uri $uri/ @pnp4nagios;
+}
+
+location @pnp4nagios {
+    if ( $uri !~ /pnp4nagios/index.php(.*)) {
+        rewrite ^/pnp4nagios/(.*)$ /pnp4nagios/index.php/$1;
+        break;
+    }
+
+    fastcgi_pass unix:/var/run/php5-fpm.sock;
+    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;
+}
+
diff --git a/contrib/nginx/nginx.security.conf b/contrib/nginx/nginx.security.conf
new file mode 100644
index 0000000..5585189
--- /dev/null
+++ b/contrib/nginx/nginx.security.conf
@@ -0,0 +1,19 @@
+# Security - Basic configuration
+    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
+    location ~ /\. {
+        deny all;
+        access_log off;
+        log_not_found off;
+    }





More information about the icinga-checkins mailing list