OK, I know what is wrong, it is a misunderstanding, when you configure A "Custom Error Page", the path is a URL, not a file path.
You have to set the error URL to "/404.html", then add a static context, equivalent to "Alias" in Apache, mapping "/404.html" to "/opt/lsws/404.html".