Unable to continue fresh install - http://SERVER_IP/install.php giving 502 Bad Gateway

Hello, I did fresh instal according to official guide - RHEL / CentOS 7 - Nginx - LibreNMS Docs, and I’m getting “502 Bad Gateway” while browsing http://SERVER_IP/ or http://SERVER_IP/install.php.

When I ran ./validate.php first time, I got “config.php does not exist, please copy config.php.default to config.php”. This was resolved by cp config.php.default config.php and then adding username/pass into ### Database config section of config.php.

I have ended up with this:

-bash-4.2$ ./validate.php

Component Version
LibreNMS 1.57-11-g10e6ac1
DB Schema No Schema (0)
PHP 7.3.11
MySQL 5.5.64-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2
====================================

[OK] Composer Version: 1.9.1
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
[WARN] You have not added any devices yet.
[FIX]:
You can add a device in the webui or with ./addhost.php

and after “./lnms migrate” with this:

-bash-4.2$ ./validate.php

Component Version
LibreNMS 1.57-11-g10e6ac1
DB Schema 2019_10_03_211702_serialize_config (145)
PHP 7.3.11
MySQL 5.5.64-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2
====================================

[OK] Composer Version: 1.9.1
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] You have not added any devices yet.
[FIX]:
You can add a device in the webui or with ./addhost.php

-bash-4.2$ php-fpm --version
PHP 7.3.11 (fpm-fcgi) (built: Oct 22 2019 08:11:04)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

-bash-4.2$ cat /etc/nginx/conf.d/librenms.conf
server {
listen 80;
server_name SERVER_IP;
root /opt/librenms/html;
index index.php;

charset utf-8;
gzip on;
gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /api/v0 {
try_files $uri $uri/ /api_v0.php?$query_string;
}
location ~ .php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
}
location ~ /.ht {
deny all;
}
}

I have tried install this from scrath several times with no luck (same result) :confused:

Instead of ip try hostname?

Hi Kevin,
I have tried several things as “server_name” - hostname with and without domain, server IP, … - none of it changed anything. After each change I did restart php-fpm, mariadb, nginx.

Hello,

Eventually I was able to resolve this! There were 2 errors in my config, both related to /etc/php-fpm.d/www.conf:

  1. I did forget to uncomment (my bad, stupid):
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
  1. Path “listen = /run/php-fpm/php-fpm.sock” was missing “/var/” in front of “/run/”. This is maybe something that has changed since the official install guide (CentOS 7 / nginx) was written.

In order to continue with configuration, I also had to delete config.php so I could add librenms user (maybe I could also used workaround Kevin suggested in different thread - "php adduser.php 10 ")