Trusted Host Settings Not enabled
Every entry in the array contains a RegEx. So you must escape the dot too.

$settings['trusted_host_patterns'] = array( '^www\.example\.com$' );


This will match the exact the host "www.example.com".