RaspberryPi Web Server
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install apache2 -y
sudo a2enmod rewrite
sudo service apache2 restart
We’re using the -y flag which will automatically install required and suggested Apache2 packages.
We need to change one setting on Apache2 to allow .htaccess overrides in the /var/www directory,
so open sudo nano /etc/apache2/apache2.conf
and change the AllowOverride None to AllowOverride All as shown below:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Restart apache2
sudo service apache2 restart
sudo apt-get update
sudo apt-get upgrade
sudo apt-get clean
Insall and configure Samba
sudo apt-get install samba samba-common-bin
sudo nano /etc/samba/smb.conf
Add this at the bottom
[www]
comment = Pi www
public = yes
writeable = yes
browsable = yes
path = /var/www
valid users = pi
guest ok = yes
create mask = 0777
directory mask = 0777
sudo smbpasswd -a pi
sudo /etc/init.d/samba restart
Raspberry Pi Docker Raspberry Pi
You need Docker runtime installed on your rpi. https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/
curl -sSL https://get.docker.com | sh
git clone https://github.com/Lewiscowles1986/mailhog-docker-rpi
cd mailhog-docker-rpi
sudo docker build -t mailhog:alpine-pi .
sudo docker run --restart always --name mailhog -p 1025:1025 -p 8025:8025 -d mailhog:alpine-pi
sudo apt-get install php libapache2-mod-php -y
sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt install php7.3
sudo apt install php7.3-cli php7.3-common php7.3-curl php7.3-mbstring php7.3-mysql php7.3-xml
sudo apt install php7.3-bcmath php7.3-bz2 php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-readline php7.3-xml php7.3-zip
sudo a2dismod php5.6
sudo a2enmod php7.2
sudo service apache2 restart
sudo apt-get install ppa-purge
sudo apt-get purge php7.0-common
sudo apt-get purge php7.*
sudo apt-get install php7.3-gd
sudo apt-get install php7.3-zip
sudo apt-get install mysql-server php-mysql -y
sudo service apache2 restart
sudo apt-get install phpmyadmin -y
link: http://192.xxx.x.xxx/phpmyadmin/
username: phpmyadmin
sudo dpkg-reconfigure phpmyadmin
The /var/www is the root directory of the website, it is currently owned by the “root” user. We must ensure the "Pi" user account can write files to /var/www directory.
sudo chown www-data:www-data /var/www
sudo chmod 775 /var/www
sudo usermod -a -G www-data pi
# also
sudo chown -R pi:pi /var/www
sudo apt-get install git
sudo apt-get update
sudo apt-get install ssmtp
sudo apt-get install mailutils
***/etc/ssmtp/ssmtp.conf ***
root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
AuthUser=YourGMailUserName@gmail.com
AuthPass=YourGMailPassword
UseSTARTTLS=YES
rewriteDomain=your.domain
FromLineOverride=YES
If you would like your website to be able to send emails which appear to be sent from a person with a nice name like “John Doe” or “Your super web site” instead of from a simple sender name like you@your.domain, then you need to make sure that in the /etc/ssmtp/ssmtp.conf file the FromLineOverride line is commented (#) or set to NO and you need to give a nice name to the www-data user. You can do this by editing the passwords file: nano /etc/passwd
Find the line corresponding to www-data and set the fifth value in it to a nice name like “Your super website”.
<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "test@test.com";
$to = "kreativan.dev@gmail.com";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";
?>
/opt/vc/bin/vcgencmd measure_temp