Site displays with Curl but not within the browser

For such case please add line in /etc/nsswitch.conf

hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4

to be

hosts: dns files mdns4_minimal [NOTFOUND=return] mdns4

For someone reading this in the future:

For me it wasn't a DNS issue but one with https:

curl my-domain.com worked because it used http protocol. However, modern browsers seem to always attempt to use https nowadays and that's not always obvious.

So for me, setting up letsencrypt and enabling https solved the issue.