[SOLVED] Mattermost Nginx Configuration

Ubuntu 16.04
postgresql
Mattermost 4.2.0
NginX
is my system.
I following to this guide.

Everything was okay before nginx configuration. I create /etc/nginx/sites-available/mattermost file and configurated as the guide says. Deleted the default file, linked the mattermost file to enabled sites. Restarted the nginx service.

But now I have
502 Bad Gateway after
curl http://localhost command.

What could I did wrong?

cat /var/log/nginx/error.log

> 2017/10/12 11:37:08 [error] 1963#1963: *5 connect() failed (111: Connection refused) while connecting to upstream, client: _my_ip_, server: mattermost._example_.com, request: "GET / HTTP/1.1", upstream: "http://_server_ip_:8065/", host: "www._example_.com"
> 2017/10/12 11:37:12 [error] 1963#1963: *3 connect() failed (111: Connection refused) while connecting to upstream, client: _my_ip_, server: mattermost._example_.com, request: "GET / HTTP/1.1", upstream: "http://_server_ip_:8065/", host: "mattermost._example_.com"

Hi @eicecek,

Thanks for your feedback,

Perhaps these docs will help?:

You could also try upgrading to the latest version of Mattermost which shipped today (Oct 16th).

Hi.

First you need to create a sybolic link in the sites-enabled folder for the config to be available.

Furthermore I have problems with self-created certificates for https connections.
After not mentioning these in the conf the I could access mattermost.