Icingaweb2, nginx, freebsd and css

Hello folks,

I trying to install icinga2/icingaweb2 in a FreeBSD jail.

after using icingacli to generate the nginx config. I try to run the icingaweb2/setup. Bad luck my log return an error:
/usr/local/www/icingaweb2/public/css/icinga.min.css" failed (2: No such file or directory)

For sure, the css format is LESS. But I can figure how to tell to nginx to use the less format? Did I need to recompile it with the right option? Something in the configuration file ?

For now, it’s very frustrating…

Thanks in advance for any advice, help or pointer you can send to me.

Have a nice day, and take care of you.

Jacques

Hi,

you don’t have to compile anything for Icinga Web 2 to work. Yes, Icinga Web 2 uses LESS but this is transparently compiled to CSS. The thing is however, that the compiled CSS is not stored in Icinga Web 2’s installation path. So the path /usr/local/www/icingaweb2/... is not correct.

The URL the browser accesses the CSS by is /icingaweb2/css/icinga.min.css but that doesn’t relate relatively to /usr/local/www/icingaweb2/ but to a temporary file location. The default path (in a non-jail env) is /tmp/FileCache_icingaweb/.

Besides, that’s also used for JavaScript, so consider allowing access to the entire directory. :wink:

1 Like

Hello Nilmerg,

Thanks to take time to answer to me.

I found this “incorrect” path in the nginx log:

error] 8535#101733: *20 open() "/usr/local/www/icingaweb2/public/css/icinga.min.css" failed (2: No such file or directory), client: 192.168.xx.yy, server: icinga.example.net, request: "GET /css/icinga.min.css HTTP/1.0", host: "icinga.example.net", referrer: "https://icinga.example.net/icingaweb2"

So, if I understand correctly “something” should take the LESS file, transform it into CSS, put in a tmp folder and indicate a false path to nginx.

Does the whole directory (/usr/local/www/icingaweb2) belong to icingaweb2 or to the www user?

I can’t find the temporary file location for the ‘css’. Is there a file where it’s define?

Once again, thanks for the time you spend for me,

Take care,
Jacques

This “something” would be Icinga Web 2. Nginx does not need to know the path neither does it get a false one from anything else.

I don’t know how you installed Icinga Web 2 or what FreeBSD is using here.

It’s the temporary file location for your environment where PHP is running on. I don’t know anything about FreeBSD jails, but it’s usually directly under /tmp, so there must be a similar path for a FreeBSD jail application?

Anyway, maybe you just got your web server configuration wrong, as nginx itself does not need to open any css file of Icinga Web 2. Nginx only needs to be able to access the public directory and therein the index.php file to which any request should be sent. (No matter if it’s a real file or not)

1 Like

Hello,

I’m back after looking for a solution.

As I read in other site (like wikipedia) is that less.js is used to compile on the fly less file.
I did not have this file on my jail.

Is it possible it’s really missing from my installation?

Thanks again and agin for your time.

Jacques

No. You don’t need less.js. You have to configure your webserver properly.

You seem to be installing Icinga Web 2 for the first time from source. Are you following the official documentation? We don’t cover FreeBSD there, but most instructions can be applied 1:1.

There you’ll get a nginx configuration like this:

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

Adjust it so that it matches your environment (paths, etc) and you don’t have to worry about LESS at all.

1 Like

Hello,

Well in fact I installed icingaweb2 from the package system. So i remove it in order to install it form source as you suggest.

The ./bin/icingacli setup config directory failed:

./icingacli setup config directory    
PHP Fatal error:  Uncaught Error: Call to undefined function Icinga\Util\bindtextdomain() in /usr/local/www/icingaweb2/library/Icinga/Util/Translator.php:158
Stack trace:
#0 /usr/local/www/icingaweb2/library/Icinga/Application/ApplicationBootstrap.php(588): Icinga\Util\Translator::registerDomain('icinga', '/usr/local/www/...')
#1 /usr/local/www/icingaweb2/library/Icinga/Application/Cli.php(41): Icinga\Application\ApplicationBootstrap->setupInternationalization()
#2 /usr/local/www/icingaweb2/library/Icinga/Application/ApplicationBootstrap.php(336): Icinga\Application\Cli->bootstrap()
#3 /usr/local/www/icingaweb2/bin/icingacli(7): Icinga\Application\ApplicationBootstrap::start()
#4 {main}
  thrown in /usr/local/www/icingaweb2/library/Icinga/Util/Translator.php on line 158

Fatal error: Uncaught Error: Call to undefined function Icinga\Util\bindtextdomain() in /usr/local/www/icingaweb2/library/Icinga/Util/Translator.php:158
Stack trace:
#0 /usr/local/www/icingaweb2/library/Icinga/Application/ApplicationBootstrap.php(588): Icinga\Util\Translator::registerDomain('icinga', '/usr/local/www/...')
#1 /usr/local/www/icingaweb2/library/Icinga/Application/Cli.php(41): Icinga\Application\ApplicationBootstrap->setupInternationalization()
#2 /usr/local/www/icingaweb2/library/Icinga/Application/ApplicationBootstrap.php(336): Icinga\Application\Cli->bootstrap()
#3 /usr/local/www/icingaweb2/bin/icingacli(7): Icinga\Application\ApplicationBootstrap::start()
#4 {main}
  thrown in /usr/local/www/icingaweb2/library/Icinga/Util/Translator.php on line 158

The server files is installed in /usr/local/www/icingaweb2 and the config directory should be /usr/local/etc/icingaawbe2.

I use nginx and postgresql. The postgresql exist and can be access.

I installed all requirements except php-ZendFramework-Db-Adapter-Pdo-Mysql. Instead I installed php-pdo_pgsql and php-pgsql.

Thanks again,
Jacques Foucry

Hi @jfoucry,

I think you’ve missed some deps according to

gettext is missing for sure.

All the best,
Eric

1 Like