If you can reach the server via http://localhost:8065 but not via http://yourdomain.com:8065 that suggests you may have a firewall that is blocking access to port 8065 over public network interfaces, but not the loopback interface used to reach localhost. Please could you check if you have some firewall activated, or iptables rules that are blocking this?
Additionally, could you please check if the Mattermost server is listening on only the loopback interface using sudo netstat -plnt. (You can paste the output of that command here if you need assistance interpreting it).