Hi Misc,

I am working on the new installation of LibreNMS using Nginx as the
server 

# uname -a
OpenBSD lnms.int.autonlab.org 6.0 GENERIC.MP#2 amd64

Installation went well

gd      yes
mysql   yes
snmp    yes
mcrypt  yes
pear    yes

I followed pkg-readmes and mysql, php, and nginx are correctly
configured and working in the INSECURE mode(no chroot). Please no
remarks if you are not familiar with LibreNMS and the fact that it has
to be run in the insecure mode.

I followed readme file

librenms-201607

everything formally went well (I chose Web-based installation) including
connecting to MariaDB. I can log into LibreNMS and the dashboard is
displayed OK. The problem occurs when I tried to preform any of the
actions from the top menu including logout. I get 

500 Internal Server Error

It almost feels there is something wrong with paths to PHP scripts which
are supposed to be executed by pressing those buttons. The only
interesting thing I see in my log files is this

# tail -20 php-fpm.log
[13-Dec-2016 21:35:55] NOTICE: exiting, bye-bye!
[13-Dec-2016 21:36:04] NOTICE: fpm is running, pid 32265
[13-Dec-2016 21:36:04] NOTICE: ready to handle connections
[13-Dec-2016 21:48:07] NOTICE: Terminating ...
[13-Dec-2016 21:48:08] NOTICE: exiting, bye-bye!
[13-Dec-2016 21:49:49] NOTICE: fpm is running, pid 51714
[13-Dec-2016 21:49:50] NOTICE: ready to handle connections
[13-Dec-2016 21:56:41] WARNING: [pool www] server reached
pm.max_children setting (5), consider raising it
[13-Dec-2016 22:07:20] NOTICE: Terminating ...
[13-Dec-2016 22:07:20] NOTICE: exiting, bye-bye!
[13-Dec-2016 22:08:55] NOTICE: fpm is running, pid 67014
[13-Dec-2016 22:08:55] NOTICE: ready to handle connections
[13-Dec-2016 22:11:11] NOTICE: Terminating ...
[13-Dec-2016 22:11:11] NOTICE: exiting, bye-bye!
[13-Dec-2016 22:11:14] NOTICE: fpm is running, pid 663
[13-Dec-2016 22:11:14] NOTICE: ready to handle connections
[13-Dec-2016 22:35:03] NOTICE: Terminating ...
[13-Dec-2016 22:35:03] NOTICE: exiting, bye-bye!
[13-Dec-2016 22:35:04] NOTICE: fpm is running, pid 8430
[13-Dec-2016 22:35:05] NOTICE: ready to handle connections

As you can see I didn't create a new pool but I commented out chroot
part in php-fpm so it is not running chrooted. 


This is my complete /etc/nginx/nginx.conf file 

# Take note of http://wiki.nginx.org/Pitfalls

user  www;
worker_processes  4;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#error_log  syslog:server=unix:/dev/log,severity=notice;

pid        logs/nginx.pid;

worker_rlimit_nofile 1024;
events {
    worker_connections  800;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    index         index.php;

    #log_format  main  '$remote_addr - $remote_user [$time_local]
"$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    #access_log  syslog:server=unix:/dev/log,severity=notice main;

    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  650;

    #gzip  on;

    server_tokens off;

    server {
        listen       192.168.6.251:80;
        server_name  lnms.int.autonlab.org;
        root         /var/www/librenms/html;
        index        index.php

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root  /var/www/htdocs;
        }
        location / {
           # try_files   $uri $uri/ @librenms;
           try_files   $uri $uri/ @lnms;
        }
        # pass the PHP scripts to FastCGI server listening on unix
socket
        #
        location ~ \.php$ {
            try_files      $uri $uri/ =404;
       #    fastcgi_pass   unix:run/php-fpm.sock;
            fastcgi_pass   unix:/var/www/run/php-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  DOCUMENT_ROOT $document_root;
            fastcgi_param  SCRIPT_FILENAME
$document_root$fastcgi_script_name;
       #    fastcgi_param  DOCUMENT_ROOT /var/www$document_root;
       #    fastcgi_param  SCRIPT_FILENAME
/var/www$document_root$fastcgi_script_name;
       #    fastcgi_param  SCRIPT_FILENAME
$document_root$fastcgi_script_name;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include        fastcgi_params;
        }
        location ~ /\.ht {
            deny  all;
        }
        location @lnms {
            rewrite     ^api/v0(.*)$ /api_v0.php/$1 last;
            rewrite     ^(.+)$ /index.php/$1 last;
        }
   } 
}


As you can see my nginx.conf file is not 100% the same as Stuard's
example from readmes but with his example I could not connect to the
server. I experimented with having @librenms inseted of @lnms but I got
the same result. The one other thing I did different was my
/var/www/librenms is owned by _librenms:_librenms. I have not changed
the permission on any file. I tried this after originally trying with
root ownership of all files. 


Could somebody with better knowledge of nginx, php-fpm give me some idea
what am I doing wrong? I know that the error is very generic and hard to
debug.


Most Kind Regards,
Predrag Punosevac 

Reply via email to