Config of networking and/or Apache server ... 502's indicate bad gateway don't they?
Moodle server has been given a static IP, correct? After changing config file of apache, did restart service, yes?
cat /etc/resolv.conf
list the IP address of the DNS servers configured.
Then:
dig @ONEOFTHOSEIP FQDNOFMOODLESERVER
Re-check /etc/hosts file (typo)
From a workstation, check ports using something like nmap. Can you do a constant ping at the IP address of the moodle server?
Install nmap on server and test ports.
'spirit of sharing', Ken