The hosts file was not the problem: the router forwarded the wrong port.
- The asker had only port 8080 forwarded in the router, so the site worked locally but not from the internet.
- Forward TCP port 80 in the router to the PC that runs the web server (and allow it in Windows Firewall).
- Test the domain from a phone on mobile data or another network.