mbolli / nfsen-ng

Responsive NetFlow visualizer built on top of nfdump tools.
Apache License 2.0
231 stars 43 forks source link

nginx: Frontend error: something went wrong #72

Closed perceival closed 2 years ago

perceival commented 2 years ago

I am struggling to get any charts or just anything from web interface. Collector seams to be working, nfsen-ng process is working but still frontend is returning quite vague: nfdump command: < × something went wrong. ? Is nfsen-ng compatible with php 8.0.16? BTW I am running it on fedora with systemd and nginx.

perceival commented 2 years ago

Looks like problem specific to nginx configuration. Apache using the same installation of nfsen-ng is working fine. In both php and rrd is reported as working. Unfortunately I haven't found the root cause.

mbolli commented 2 years ago

PHP 8 is not officially supported yet, have to look into it

perceival commented 2 years ago

Indeed seems nfsen-ng is not compatible with PHP 8. Here is how to make it work with nginx and in parallel with PHP 8.x, in my case on Fedora 35:

sudo dnf install http://rpms.remirepo.net/enterprise/remi-release-35.rpm
sudo dnf install php74 php74-php-cli php74-php-common php74-php-fpm php74-php-gdphp74-php-intl php74-php-json php74-php-mbstring php74-php-mysqlnd php74-php-pdo php74-php-pecl-apcuphp74-php-pecl-json-post php74-php-pecl-jsonpath php74-php-pecl-mcrypt php74-php-pecl-memcache php74-php-process php74-runtime php74-php-pecl-rrd php74-php-pear

replace apache with nginx for listen.acl_users, user and group in /etc/opt/remi/php74/php-fpm.d/www.conf than sudo systemctl enable --now php74-php-fpm Nginx config file should contain:

server {
    listen 443;
    root /[path]/nfsen-ng;
    index index.html index.htm;
    server_name [server names];

    location / {
        rewrite ^/$ /frontend break;
    }

    # we only do php on api
    location /api {
        if (!-e $request_filename) {
            rewrite ^/api/(.*)$ /backend/index.php?request=$1 break;
        }
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/var/opt/remi/php74/run/php-fpm/www.sock;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    } 

        ssl_certificate "/etc/pki/tls/certs/[cert].pem";
        ssl_certificate_key "/etc/pki/tls/private/[key].pem";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers PROFILE=SYSTEM;
        ssl_prefer_server_ciphers on;
}

Thank you @moozer for your hints there.

mbolli commented 2 years ago

@perceival The latest master should be working even with PHP 8.1 now, testers are welcome.

perceival commented 2 years ago

@mbolli Works perfectly fine. Thank you!