[solved] How to set the certificate of the site

I experienced a server malfunction, I reconstructed the environment. Mattermost is also similar. I am planning to build it in the same condition as before. However, I also encountered a certificate problem this time.

When I access Mattermost, Mattermost seems to be requesting a certificate of the original domain.

My mattermost is ’ mattermost.example.com’, and access it.
mattermost is not a certificate of “mattermost.example.com” but it requires a certificate of “example.com”.

Errors by web browser.

[CHROME] NET::ERR_CERT_COMMON_NAME_INVALID
[FIREFOX] SSL_ERROR_BAD_CERT_DOMAIN

I abandon the use of example.com and I assign example.com a certificate of mattermost.example.com to example.com. Then I will be able to access Mattermost.
And I can not log in. The error is as follows.

Invalid or expired session, please login again.

Even if I set a wild card certificate of * .example.com.

When I installed Mattermost for the first time, there was no such thing. At that time it was whether the certificate could be used or not. I am restoring Mattermost (including config.json) from the backup file. I am not using backup data in the environment reconstruction of the server.

How do I inherit the certificate of it when I access mattermost.example.com?
The setting in nginx.conf is the contents in Mattermost’s manual. The certificate uses Let’s Encrypt (external).


CentOS 7.5 / nginx 1.13.8 / PHP 7.1.23

I solved my self. I have DNS setup and rewritten config.json, and it is possible to connect HTTPS without problems.

2 Likes