we use mattermost 3.6. At a random time server stops responding and nginx gives 502 error. Service nginx is running. Service mattermost is running, but not working. The problem is solved by restarting service mattermost. I would like to have a more stable service mattermost.
Before restarting you should probably check the logs for errors
tail -100 /opt/mattermost/log/mattermost.log
The log location will depend on the directory where you installed it
Did you check your ulimits?