Secondary title: How to monitor raspberry pi remotely
linux-dash is a cool project that displays stats about a linux machine through the browser. It is a cool webapp to install on the pi.
Credit goes to xmodulo. My post is very similar with a small path change for the pi.
First update the repository:
sudo apt-get update
Then install git (to pull the linux-dash code), nginx (the webserver) and php packages
sudo apt-get install git nginx php5-json php5-fpm php5-curl
Edit the linuxdash config
sudo nano /etc/nginx/conf.d/linuxdash.conf
On this file you want to paste the followin settings. Notice how the path for the site root is changed from the original how to. This is because this path is changed on the default raspbian configuration:
server {
server_name $domain_name;
listen 8080;
root /usr/share/nginx/www;
index index.html index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/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;
}
# PHP-FPM via sockets
location ~ \.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
try_files $uri $uri/ /index.php?$args;
include fastcgi_params;
}
}
Disable the default site configuration
sudo rm /etc/nginx/sites-enabled/default
Configure php-fpm to use the correct user www-data
sudo nano /etc/php5/fpm/pool.d/www.conf
and change the lines for the user and the group.
. . .
user = www-data
group = www-data
. . .
Pull linux dash code, install it on the correct folder and set permissions:
cd ~
mkdir temp
cd temp
git clone https://github.com/afaqurk/linux-dash.git
sudo cp -r linux-dash/ /usr/share/nginx/www/dash/
sudo chown -R www-data:www-data /usr/share/nginx/www/dash
sudo chown -R www-data:www-data /usr/share/nginx/www
Restart the services:
sudo service php5-fpm restart
sudo service nginx restart
Now you can monitor your pi via the url:
http://you-ip-address-here:8080/dash/