based on tutorial here: https://www.element14.com/community/community/raspberry-pi/raspberrypi_projects/blog/2014/04/02/pi-webpage-reboot
and setting up .htaccess https://www.debiantutorials.com/password-protecting-a-directory-with-apache-and-htaccess/
and setting up apache and install php https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md
and stats python code taken https://learn.pimoroni.com/tutorial/networked-pi/raspberry-pi-system-stats-python
sudo apt update sudo apt install apache2 -y
sudo apt install php libapache2-mod-php -y
sudo apt-get install python-pip sudo pip install psutil flask
##copy /remote/ to /var/www/html/ ### apache documents folder
Make sure our python directory is writable & X (notably reboot.log is writable) ### Find a better way then chmod 777 if possible!!!
sudo chmod 777 /var/www/html/remote/python/ sudo chmod 777 /var/www/html/remote/python/reboot.log
add the following code to bottom of file using sudo visudo to allow apache to execute python scripts that call sudo user
sudo visudo
www-data ALL=/sbin/reboot www-data ALL=NOPASSWD: /sbin/reboot www-data ALL=/sbin/shutdown www-data ALL=NOPASSWD: /sbin/shutdown
#admin pw= your choice $fakeuser pw= fake
sudo htpasswd -c /etc/apache2/.htpasswd admin sudo htpasswd /etc/apache2/.htpasswd fakeuser
sudo nano /etc/apache2/apache2.conf
<Directory /var/www/> AllowOverride All
sudo /etc/init.d/apache2 restart