I have generate two SSL certificates, one is RSA certificate and the other one is ECC certificate, for my domain forum.example.com and have implemented it in Nginx by using the following configuration:
listen 443 ssl http2; listen [::]:443 ssl http2;
server_name forum.example.com;
access_log /var/log/nginx/forum.example.com.log;
ssl on;
ssl_certificate /path/forum.example.com/fullchain.cer;
ssl_certificate_key /path/forum.example.com/forum.example.key;
ssl_certificate /path/forum.example.com_ecc/fullchain.cer;
ssl_certificate_key /path/forum.example.com_ecc/forum.example.com.key;
ssl_dhparam /path/dhparams.pem;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
http2_idle_timeout 5m;
# Rest of the configuration
The idea behind this is to use ECC certificate whenever possible, and in the case where a client doesn't support ECC certificates, RSA certificate will be used. However, on my machine sometimes I see RSA certificate being used and sometimes ECC certificate being used. My guess is some round-robin method is being used to determine which certificate to use.
Is there a way to prioritise ECC over RSA, and if the client doesn't support ECC, the server will use RSA certificate?