Set SSL/TLS Certificate for Server#

In a small-scale or intranet server, it is usually not necessary to set up an SSL/TLS certificate. However, if you are setting up a public server, it is very necessary to set up an SSL/TLS certificate, which can effectively prevent some malicious attacks.

First, you need an available certificate. You can choose a free certificate from Let’s Encrypt or other commercial certificates.

In the next step, there are two ways to configure SSL/TLS encryption:

Enable SSL/TLS Encryption Individually#

Ourchat Server itself can also configure certificate encryption without depending on nginx, the operation steps are as follows:

  • Use certbot to get a certificate

  • Set http.toml according to the certificate

Set tls.enable to true,

Please set as follows:

field

Use

tls.server_tls_cert_path

The .pem file path of the server certificate.

tls.server_key_cert_path

The .key file path of the server certificate.

tls.client_tls_cert_path

The .pem file path of the client certificate.

tls.client_key_cert_path

The .key file path of the client certificate.

tls.ca_tls_cert_path

The .pem file path of the root certificate for the server certificate.

tls.client_ca_tls_cert_path

The .pem file path of the root certificate for the client certificate.

At the same time, the client certificate is used for mutual authentication and is not mandatory, only set in special cases.