Docs: Add an example for Apache VHost configuration into Advanced Topics

This commit is contained in:
Michael Friedrich 2017-09-08 13:08:26 +02:00
parent 3190b7dea3
commit b20fc1c464
1 changed files with 84 additions and 3 deletions

View File

@ -1,7 +1,88 @@
# Advanced Topics <a id="advanced-topics"></a> # Advanced Topics <a id="advanced-topics"></a>
This chapter contains advanced Icinga Web 2 topics such as source installation This chapter provides details for advanced Icinga Web 2 topics.
or automation hints.
* [VirtualHost configuration](20-Advanced-Topics.md#virtualhost-configuration)
* [Source installation](20-Advanced-Topics.md#installing-from-source)
* [Automated setup](20-Advanced-Topics.md#web-setup-automation)
## VirtualHost Configuration <a id="virtualhost-configuration"></a>
This describes how to run Icinga Web 2 on your FQDN's `/` entry point without
any redirect to `/icingaweb2`.
### VirtualHost Configuration for Apache <a id="virtualhost-configuration-apache"></a>
Use the setup CLI commands to generate the default Apache configuration which serves
Icinga Web 2 underneath `/icingaweb2`.
The next steps are to create the VirtualHost configuration:
* Copy the `<Directory "/usr/share/icingaweb2/public">` into the main VHost configuration. Don't forget to correct the indent.
* Set the `DocumentRoot` variable to look into `/usr/share/icingaweb2/public`
* Modify the `RewriteBase` variable to use `/` instead of `/icingaweb2`
Example on RHEL/CentOS:
```
vim /etc/httpd/conf.d/web.icinga.com.conf
<VirtualHost *:80>
ServerName web.icinga.com
## Vhost docroot
# modified for Icinga Web 2
DocumentRoot "/usr/share/icingaweb2/public"
## Rewrite rules
RewriteEngine On
<Directory "/usr/share/icingaweb2/public">
Options SymLinksIfOwnerMatch
AllowOverride None
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAll>
Require all granted
</RequireAll>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from all
</IfModule>
SetEnv ICINGAWEB_CONFIGDIR "/etc/icingaweb2"
EnableSendfile Off
<IfModule mod_rewrite.c>
RewriteEngine on
# modified base
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
<IfModule !mod_rewrite.c>
DirectoryIndex error_norewrite.html
ErrorDocument 404 /error_norewrite.html
</IfModule>
</Directory>
</VirtualHost>
```
Reload Apache and open the FQDN in your web browser.
```
systemctl reload httpd
```
## Installing Icinga Web 2 from Source <a id="installing-from-source"></a> ## Installing Icinga Web 2 from Source <a id="installing-from-source"></a>
@ -312,7 +393,7 @@ password = "api"
Finally visit Icinga Web 2 in your browser to login as `icingaadmin` user: `/icingaweb2`. Finally visit Icinga Web 2 in your browser to login as `icingaadmin` user: `/icingaweb2`.
## Automating the Installation of Icinga Web 2 ## Automating the Installation of Icinga Web 2 <a id="web-setup-automation"></a>
If you are automating the installation of Icinga Web 2, you may want to skip the wizard and do things yourself. If you are automating the installation of Icinga Web 2, you may want to skip the wizard and do things yourself.
These are the steps you'd need to take assuming you are using MySQL/MariaDB. If you are using PostgreSQL please adapt These are the steps you'd need to take assuming you are using MySQL/MariaDB. If you are using PostgreSQL please adapt