Installing Linux Dash with Nginx on Ubuntu 18.04 LTS

0
2006

This guides presents a simple way installing Linux Dash with Nginx on Ubuntu 18.04 LTS. Linux Dash is an opensource web based monitoring dashboard for Linux systems. It displays system metrics and properties such as number of running processes, number of logged in users, the CPU load, memory statistic, disk usage, network connections, internet connection speed etc. You can happily check the Linux Dash demo here.

Installing Linux Dash with Nginx on Ubuntu 18.04 LTS

Linux Dash is a small program that can be installed from source code that can be locally cloned from a Github repository. Being a simple application, it doesn’t require any database backend. It however requires a web server such as Apache or Nginx and the server-side scripting language such as PHP.

To begin the installation with, update and upgrade your system packages.

apt update
apt upgrade

Install the git package for cloning Linux Dash repository

apt install git

Install Nginx web server

apt install nginx

Install PHP

apt install php7.2 php7.2-curl php7.2-fpm

Configure Linux Dash Nginx Server Block

To configure Nginx for Linux Dash, you need to create the server block configuration under /etc/nginx/sites-available directory.

vim /etc/nginx/sites-available/linux-dash

Add the following contents to the configuration file and make adjustments accordingly.

server {
    server_name     linuxdash.example.com;
    listen          80;
    root            /var/www/html;
    index           index.html index.php;
    access_log      /var/log/nginx/linuxdash_access.log;
    error_log       /var/log/nginx/linuxdash_error.log;
 
    location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
            try_files $uri =404;
            expires max;
            access_log off;
            add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }
 
    location /linux-dash {
        index index.html index.php;
    }
 
    location ~ \.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
            if (!-f $document_root$fastcgi_script_name) {
                    return 404;
            }
            try_files $uri $uri/ /index.php?$args;
            include fastcgi_params;
    }
}

Save the configuration file and quit.

Once that is done, you need to enable the Linux Dash site. This can be done by creating symbolic links from this server block configuration to the sites-enabled directory.

ln -s /etc/nginx/sites-available/linux-dash /etc/nginx/sites-enabled/

Next, remove the default Nginx site configuration.

rm -rf /etc/nginx/{sites-available,sites-enabled}/default

Download Linux Dash

Navigate to the Linux Dash root directory and clone the its git repository there;

cd /srv
git clone https://github.com/afaqurk/linux-dash.git

Set the proper ownership of the Linux Dash web directory.

chown -R www-data.www-data linux-dash

Open Nginx through firewall.

ufw allow "Nginx HTTP"

Verify Nginx configuration syntax

nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart Nginx

systemctl restart nginx

The Linux Dash configuration is done. To check the web user interface, enter your server hostname or IP on the browser and add /linux-dash as the suffix.

http://server_IP/linux-dash

installing Linux Dash with Nginx on Ubuntu 18.04 LTS

That was all about installing Linux Dash with Nginx on Ubuntu 18.04 LTS. Enjoy.

LEAVE A REPLY

Please enter your comment!
Please enter your name here