Some pages in the menu are not meant for everyone in my network. So, I have restricted those with a username/password. Here’s how:
Browse to htaccesstools.com/htpasswd-generator/ and fill in the form, ie. username: music and password: player
Generate the .htpasswd and it will be something like: music:$apr1$uow7ESkz$3u7NgrmfJHwNFZtfNxBeT.
Copy this line into a file on Volumio, I did:
nano /home/pi/.htpasswd
Now change the config file for nginx to use this authentication method:
sudo vi /var/www/_OS_SETTINGS/etc/nginx/nginx.conf
find the following text in server1 area:
# php5-fpm
location ~ \.php$ {
root /var/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_read_timeout 3600;
}
and change it to:
# php5-fpm
location ~ \.php$ {
root /var/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_read_timeout 3600;
#}
# php5-fpm restricted pages
location ~ /(settings|net-config|mpd-config|dev)\.php$ {
auth_basic "Resticted Pages!";
auth_basic_user_file /home/pi/.htpasswd;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
reboot the system
sudo reboot
The next time you go to one of the following pages:
settings.php
net-config.php
mpd-config.php
dev.php
it will ask you for a username and password.