I have installed Mattermost on a RHEL7 Server and is working fine, I want to run this on HTTPS with letsencrypt but when I make changes to Configuration Settings from Admin Console, I get error as “502 Bad Gateway”. Neither site is redirecting to HTTPS.
Certificates are fetched correctly without any error, but I feel there is something wrong as the directory /etc/nginx/sites-available/ is not available for me, I manually created /etc/nginx/sites-available/mattermost file and added contents to it.
Normally you only need to install TLS on one of NGINX or Mattermost, not both.
There are three scenarios:
Access Mattermost through a reverse proxy. You can use any webserver for that, but the instructions in the Mattermost docs are for NGINX. In this scenario, NGINX listens on port 80 and receives all requests from the client. NGINX forwards those requests to Mattermost, which is listening on port 8065. Mattermost sends the response back to NGINX which then sends that response to the client. You would use this configuration when you have more than a couple hundred users. In this scenario https is on NGINX only, and you follow these instructions: https://docs.mattermost.com/install/config-ssl-http2-nginx.html.
The third scenario is similar to the first one, except that communications between the proxy and the Mattermost server are encrypted (ie, via https). In this scenario you implement TLS on both the NGINX server and on Mattermost. You normally don’t need to do this, and the instructions don’t cover this scenario.
I was using the 1st method that you had referred, the issue I faced with this was that sites-available directory was not there before, I created that directory in installation steps earlier.
Secondly after performing these steps my site wasn’t redirecting to https, so then I added https link from Console > Configuration which resulted in 502 error.