Debian 12 has power saver enabled by default which causes your server to go to sleep if there is no mouse / keyboard interaction. To resolve this issue as discussed here, edit /etc/gdm3/greeter.dconf-defaults and update the following vars and reboot your server:
sleep-inactive-ac-type='blank'
sleep-inactive-battery-type='blank'