Installing in docker, can't activate TLS. Help

Followed the Nginx install guide as much as possible. Managed to get the SSL cert installed. My docker and mattermost app are running as normal. However, Nginx doesn’t appear to be working as intended. When I curl http://localhost i get the 301 nginx error page. When I curl https://localhost it gives me an error about he cert not matching the domain, which seems correct. But when I curl or browse to the actual domain I get 504 gateway timeout.