This has been already discussed with the use of virtual machine. But if you want your "real" power button to shut down the server it's the same. You will need this: sudo apt-get install acpid
.
Very convenient when I screw up my config since I don't usually have a local shell to shutdown.