Skip to main content

Configure TLS at server-side

Here are some configuration file examples that enables TLS

Enable server authentication

server {
server_name [YOUR_DOMAIN]
listen 443 ssl;
root /www/data;
location / {
}

proxy_http_version 1.1;
proxy_set_header Host $host;

ssl_protocols TLSv1.2 TLSv1.3;

ssl_certificate /etc/nginx/conf.d/[CERTIFICATE_FILE_NAME];
ssl_certificate_key /etc/nginx/conf.d/[KEY_FILE_NAME];
}

Enable mutual authentication (mtls)

server {
server_name [YOUR_DOMAIN]
listen 443 ssl;
root /www/data;
location / {
}

proxy_http_version 1.1;
proxy_set_header Host $host;

ssl_protocols TLSv1.2 TLSv1.3;

ssl_certificate /etc/nginx/conf.d/[CERTIFICATE_FILE_NAME];
ssl_certificate_key /etc/nginx/conf.d/[KEY_FILE_NAME];

ssl_client_certificate /etc/nginx/[CLIENT_CA_CERTIFICATE_FILE_NAME];
ssl_verify_client on;
}