Ok, I recommend windows operating system, Use C# with Visual Studio and SQL Server. For web server use IIS.
This web chat uses AJAX
and the above technology. This app does not store the messages across server reboots, it does not use a database. However it would not be hard to add that functionality if needed.