Only when they are on the same machine of course, localhost is a local accessibility for that machine only, so no outsiders can reach it without having either your firewall forwarding it from local to your network device or an application acting as a proxy(in this case nginx).
In your case you would need to either install nginx locally or use your iptables(given you're on linux) to forward it or bind mattermost to the ip you wish to use.
The external IP(as in the IP you can reach your mattermost for other computers) of the machine with mattermost installed ofc.