Debian 12 php errors during nginx config creation

  • Icinga Web 2 version: 2.11.4-2
  • Used modules and their versions (System - About): n/a
  • Web browser used: n/a
  • Icinga 2 version used (icinga2 --version): r2.14.0-1
  • PHP version used (php --version): v8.2.7
  • Server operating system and version: Debian 12

To create the nginx config, I ran icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public
but it seems the scripts can’t yet handle php 8:

PHP Deprecated:  Creation of dynamic property Icinga\Module\Setup\Clicommands\ConfigCommand::$trace is deprecated in /usr/share/php/Icinga/Cli/Command.php on line 61

Deprecated: Creation of dynamic property Icinga\Module\Setup\Clicommands\ConfigCommand::$trace is deprecated in /usr/share/php/Icinga/Cli/Command.php on line 61
location ~ ^/icingaweb2/index\.php(.*)$ {
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb2/public/index.php;
  fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb2;
  fastcgi_param REMOTE_USER $remote_user;
}

location ~ ^/icingaweb2(.+)? {
  alias /usr/share/icingaweb2/public;
  index index.php;
  try_files $1 $uri $uri/ /icingaweb2/index.php$is_args$args;
}

So while I do get parts of a config, this obviously not complete. E.g. what’s the root? So, how do I get a complete nginx config - and probably also for this, how do I fix the PHP error? I did found this topic describing similar problems, but it doesn’t provide any helpful solution.

Addendum: it also happens when using the packages directly from Debians own repository, so I’ll see that I get this resolved on.

Addendum2: it helps purging all Icinga related packages, installing them from Debians own repo and then upgrading to the ones from Icingas repo. Still, it will only show those two kinda useless blogs. I’ll see if I can get it to run with nginx and ask devs to have icingacli put out a proper config.

Hello Richard!

We’ve fixed this in Icinga Web 2 v2.12.

Best,
A/K

Obviously it isn’t as that’s the version I was using all along. But I was able to fix it anyhow.

This isn’t Icinga Web 2.12.0 !

root@197f8442e5c7:/var/www/html# icingacli version
Icinga Web 2  2.12.0    
Git Commit    77c1612cfdea5a0a407fb33e169795d90843d0b3
 
PHP Version   8.2.10 
root@197f8442e5c7:/var/www/html# icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public
location ~ ^/icingaweb2/index\.php(.*)$ {
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb2/public/index.php;
  fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb2;
  fastcgi_param REMOTE_USER $remote_user;
}

location ~ ^/icingaweb2(.+)? {
  alias /usr/share/icingaweb2/public;
  index index.php;
  try_files $1 $uri $uri/ /icingaweb2/index.php$is_args$args;
}

Ah, so the fix came during that time by coincidence. Still, I’ll keep this open until I can verify that my nginx config works and then post it here as the config icingacli gives you is very minimalistic and this seems to be a very common problem. But to verify that I’ll have to wait for 1.12.1 to fix another bug.

It works now. This is the config I use:

server {
       server_name domain.tld;
       root /usr/share/icingaweb2/public;
       index index.php;

       access_log /var/log/nginx/access.log; 
       error_log /var/log/nginx/error.log;

       
      location ~ /\. {
      	       deny all;
	       log_not_found off;
      }

      location ~ \..*/.*\.php$ {
      	       return 403;
      }

      location / {
      	       try_files $1 $uri $uri/ /index.php$is_args$args;
      }

      location ~ ^/index\.php(.*)$ {
      	       fastcgi_index index.php;
	       include /etc/nginx/fastcgi_params;
	       try_files $uri =404;
	       fastcgi_split_path_info ^(.+\.php)(/.+)$;
	       fastcgi_pass unix:/var/run/php/php-fpm.sock;
	       fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb2/public/index.php;
	       fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb2; 
	       fastcgi_param REMOTE_USER $remote_user;
     }


	location = /favicon.ico {
             alias  /etc/nginx/favicon.ico;
	     expires 6M;
        }

	listen 80;
	listen 443 ssl http2;
	ssl_certificate /etc/ssl/certs/fullchain.pem;
    ssl_certificate_key /etc/ssl/private/private.pem;

}