Apache Virtualhost for Icinga2

Posted by Carles Loriente on January 05, 2020 · 1 min read
Updated on December 25, 2024

Icinga2 is a very cool monitoring tool, we have used it in several projects with satisfactory results. You can practically monitor anything that is needed. Local or remote infrastructure, baremetal or virtual, etc.

You can configure to use Apache and Icinga2 using the following Virtualhost.


<VirtualHost *:80>
  ServerName yourdomain.com
  DocumentRoot /usr/share/icingaweb2/public
  RedirectMatch permanent "^/$"   "http://yourdomain.com/icingaweb2/"
  Alias /icingaweb2 "/usr/share/icingaweb2/public"

  <Directory "/usr/share/icingaweb2/public">
    Options SymLinksIfOwnerMatch
    AllowOverride None
    
      # Apache 2.4
      
        Require all granted
      
    
    <IfModule !mod_authz_core.c>
      # Apache 2.2
      Order allow,deny
      Allow from all
    </IfModule>
    SetEnv ICINGAWEB_CONFIGDIR "/etc/icingaweb2"
    EnableSendfile Off
    
      RewriteEngine on
      RewriteBase /icingaweb2/
      RewriteCond %{REQUEST_FILENAME} -s [OR]
      RewriteCond %{REQUEST_FILENAME} -l [OR]
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^.*$ index.php [NC,L]
    
    <IfModule !mod_rewrite.c>
      DirectoryIndex error_norewrite.html
      ErrorDocument 404 /error_norewrite.html
    </IfModule>
  </Directory>
</VirtualHost>

Download the GitHub Gist icinga_apache_vhost.conf

Tags:#icinga2#apache


Found a snippet that saved your day? Consider dropping a tip!