To view txt version of this document, click here.
Official guide: https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress
It should work on localhost or local IP. By default Apache listens on port 80.
Google Domains > DNS > Synthetic records > Dynamic DNS > Subdomain.<domain.com> > Add.
Under newly created Dynamic DNS record, clickview credentials
to get Username and Password.dns_update.sh
:server_ip="$(curl checkip.amazonaws.com)"
wget https://username:password@domains.google.com/nic/update?hostname=subdomain.yourdomain.com&myip=$server_ip -O result.txt
echo " Last run: `date`" >> result.txt
Username and password are from step 4. Also change the hostname to <subdomain>.<domain>.com
.
Run the script chronically using crontab job.
crontab -e
# m h dom m dow
0 * * * * ~/dns_update.sh
For more details, http://www.farrellf.com/projects/software/2016-05-03_Setting_Up_a_Raspberry_Pi_Web_Server/
Note IPv4 is required for the dynamic DNS to work. Somehow, the RPi is using IPv6 by default. This causes any ip checks to return IPv6 address. However, it will not work with dynamic DNS. To get IPv4 address, I added the following lines to /etc/sysctl.conf
:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.[interface].disable_ipv6 = 1
Save and close. Activate with sudo sysctl -p
, or reboot.
Reference: How to switch off IPv6 on RPi? https://www.raspberrypi.org/forums/viewtopic.php?t=138899