Seem to be missing a step in the setup

Hi,

So I am 100% new to icinga and fairly new to the whole CentOS/linux adventure. I have setup things on centOS for work before, but a lot of that were guide setup processes of (semi-) enterprise grade softwares.

That being said I am trying to setup icinga2 and icingaweb2 and I just cannot get this to work. I am pretty sure it has something to do with the webserver but I can’t for the life of me find out what step I skipped. I have followed the docs, followed 3 other icinga on centos8 guides and the result is the same.

Basically when I am supposed to go to icingaweb2/setup I get this

{urlPath}/error_unavailable.html or This page can not be found.

if I go to the IP of my server I get the apache test page so it looks like I am missing some step/part that makes apache actually serve the icingaweb pages?

In the httpd error log I get something like this:

[Sun Nov 08 10:06:25.665099 2020] [proxy:error] [pid 50308:tid 140150844241664] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (*) failed
[Sun Nov 08 10:06:25.665128 2020] [proxy_fcgi:error] [pid 50308:tid 140150844241664] [client 10.0.0.50:54634] AH01079: failed to make connection to backend: 127.0.0.1
[Sun Nov 08 10:06:59.389859 2020] [autoindex:error] [pid 50308:tid 140150646449920] [client 127.0.0.1:60172] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive

So I assume that’s where the problem sits but I am not sure how to troubleshoot that. Any help?

Hi @Thustra,

Can you post your httpd and php-fpm config?

Judging from your logs, it looks like Apache is defaulting to the /var/www/html folder, which is empty, instead of /usr/share/icingaweb2/public.

It also looks like Apache is not connecting to php-fpm, in which case you might need to add the relevant SELinux rule - see httpd_can_network_connect on https://wiki.centos.org/TipsAndTricks/SelinuxBooleans

The last few paragraphs of this page are also relevant for httpd + php-fpm configs:

httpd.conf.txt (12.0 KB) www.conf.txt (19.4 KB)

Hey thanks for taking the time to look at this.

I have put selinux in permissive mode and I think since it can show me the test page of apache the webserver itself is not being blocked?

Anyway I tried to follow the docs you linked (3 times :stuck_out_tongue: ), but the part you refer to is a bit confusing to me. As far as I can see the last part that is relevant to CentOS 8 is

"RedHat / CentOS 8 and Fedora:

systemctl start php-fpm.service
systemctl enable php-fpm.service
"

And everything after that except for generating the token is for CentOS 7, but that whole paragraph was a bit confusing to me cause as you said I feel like I at no point told httpd to show icingaweb2. Anyway I have uploaded the 2 files you referred to. Let me know if you can see something relevant.

I will be afk for a couple hours now but I will check back later. Again, thanks for having a look.

Hey @Thustra,

I strongly suggest setting back SELinux to enforced. The boolean I have listed will allow Apache make outbound communications - in this case, it would allow httpd to connect to php-fpm.

The reason the Apache test page is loading is because it is raw HTML and would not need to communicate to php-fpm or other additional services.

I’ve had a look at the config and as suspected there is no VirtualHost entry for Icinga Web - is there additional config under /etc/httpd/conf.d? If not, you may need to create a config for Icinga Web - here’s a config example:

Also see: https://icinga.com/docs/icingaweb2/latest/doc/20-Advanced-Topics/#virtualhost-configuration

It also appears your php-fpm config is listening on a unix socket (/run/php-fpm/www.sock) and not on 127.0.0.1:9000, so you may need to adjust your Apache config to use the socket, or adjust php-fpm to listen on an IP and port.

[www]

user = apache
group = apache
listen = /run/php-fpm/www.sock
listen.acl_users = apache,nginx
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

slowlog = /var/log/php-fpm/www-slow.log

php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path]    = /var/lib/php/session
php_value[soap.wsdl_cache_dir]  = /var/lib/php/wsdlcache

@0xliam Okay so I changed the ww.conf file to this

[www]

user = apache
group = apache

listen = 127.0.0.1:9000
listen.acl_users = apache,nginx
listen.allowed_clients = 127.0.0.1

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path]    = /var/lib/php/session
php_value[soap.wsdl_cache_dir]  = /var/lib/php/wsdlcache

And then I also added the contents of icingaweb2.conf to httpd.conf. And now I get the setup page to work !

Thanks a lot for the help. Especially the part of having to put that conf in the httpd.conf file I did not get at all from the install guide :confused: But well I am not exactly familar with webservers

1 Like

No worries, glad it is working! :slight_smile:

It’s up to you where you put the contents for the Apache VirtualHost block - I like to keep mine in seperate files and use the include directive.

You will likely see this in a lot of Linux applications, where there is a main config file, and a child folder called conf.d - some versions of httpd use sites-available and sites-enabled folders.