Installing Icinga Web 2 with Apache 2.4, Icinga 2 and MySQL on FreeBSD
The last entry was about
Installing Icinga 2 with MySQL on FreeBSD.
I assume that you followed the last blog entry and have now a FreeBSD machine running Icinga 2 which writes
data into the MySQL database running on the same host.
Install Icinga Web 2 and Apache 2.4 with mod_php
Using binary packages, installing is just a matter of
# pkg install apache24 mod_php56 icingaweb2
The mod_php56 package is automatically enabled in
/usr/local/etc/apache24/httpd.conf but it still needs
# cat << EOF > /usr/local/etc/apache24/modules.d/001_mod_php.conf AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps DirectoryIndex index.php index.html <FilesMatch "\.php$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch> EOF
To enable mod_rewrite in Apache, uncomment the
#LoadModue rewrite [...] line:
Copy the example Apache configuration file for Icinga Web 2:
# cp /usr/local/share/examples/icingaweb2/apache/icingaweb2.conf /usr/local/etc/apache24/Includes/
Configure PHP and Include the ZendFramework libaries:
# cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
/usr/local/etc/php.ini search for
include_path and insert the following after:
include_path = ".:/usr/local/share/ZendFramework/library"
date.timezone = Europe/Berlin
Now enable starting Apache at boot time and start it:
# sysrc apache24_enable=yes # service apache24 start
Configure Icinga Web 2
You can either configure Icinga Web 2 and MySQL from the command line or more comfortable trough its
web interface. I will show you the latter:
Create a new setup token:
# cd /usr/local/www/icingaweb2/ # ./bin/icingacli setup token create --config=/usr/local/etc/icingaweb2 The newly generated setup token is: f4911ef531ef71a4
With the token you created, go to
http://$server_ip/icingaweb2/setup and paste the token into the text field.
Then select at least the
You should not see any red components:
Database as authentication method:
In this screen, enter
icingaweb2 as the database name,
root as username and the root password you set in the previous blog entry.
icingaweb2 as authentication backend:
Setup a new user. I use
icingaadmin for the example:
Save your user preferences in the database and log to
Check if the configurations is right:
Now configure the monitoring module:
IDO as backend type
IDO Resource enter
localhost as hostname
icinga as database name,
icinga as username and the according password in the MySQL database.
To send commands to the Icinga 2 process like re-scheduling, etc. point the command file to
To protect passwords from the web interface, leave the defaults in this screen:
Have a last look at the settings:
And that's it, enjoy Icinga Web 2!