Enable both ECC and RSA on nginx

Server Norckon 508℃ 0评论



ECDSA as known as ECC, is more safer and faster than RSA, and its more suitable for use on mobile devices. But ECC not compatible with older devices, such as Windows XP or Android 2.3.

Enable both ECC and RSA on nginx will get better security and compatible with older devices.  nginx will automatically select a encrypt method for client when handshake with client via TLS protocol.


You need enable openssl 1.0.2g or above when compile nginx, because Chrome 51 above is only supported with ALPN in HTTP/2.

But openssl is a very important part of Linux system, if upgrade openssl directly maybe cause system unstable. So I recommend you to compile nginx manually with parameter --with-openssl to manually specify openssl.

wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2h.tar.gz  
tar xzvf OpenSSL_1_0_2h.tar.gz

wget http://nginx.org/download/nginx-1.11.1.tar.gz  
tar xzvf nginx-1.11.1.tar.gz  
cd nginx-1.11.1/  
nginx -V  
./configure --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --add-module=../nginx-ct-1.2.0 --with-openssl=../OpenSSL_1_0_2h --with-http_v2_module --with-http_ssl_module
make install  
service nginx restart

Notice: The above configure is for reference only. To add nginx-ct is preparing for enable Certificate Transparency only.


Before enable double certificate, please make sure your domain has both ECC and RSA certificate.

My ECC certificate is signed by Let’s Encrypt which used newest X3 intermediate certificate. RSA is universal certificate signed by AlphaSSL.

Here is my nginx configuration:

ssl_certificate ssl/letsencrypt-ecc/chained.pem;  
ssl_certificate_key ssl/letsencrypt-ecc/domain.key;  
ssl_certificate ssl/all.zeroling.com.crt;  
ssl_certificate_key ssl/all.zeroling.com.key;

ssl_prefer_server_ciphers on;  

Added support both for BCDSA and RSA in ssl_ciphers.



In header of HPKP need to specify intermediate certificate both for ECC and RSA certificate. because the certificate issuer is not same.

Public-Key-Pins 'pin-sha256="YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg="; pin-sha256="amMeV6gb9QNx0Zf7FtJ19Wa/t2B7KpCF/1n2Js3UuSU="; max-age=2592000; includeSubDomains';

If your certificate is issued by the same issuer, you’d just specify once in HPKP header. in other words, you may need not modify this line.


No influence.

CT (Certificate Transparency)

I added nginx-ct module when I compile nginx. This module is more easily to help you enable Certificate Transparency. For more information about how to enable CT, plz google it 🙂

By the way, If your web server in mainland China, please visit the article in the end of this post.

For a website which enabled double certificate, you’d just put all sct files of both certificate to same directory. and set path of the directory to ssl_ct_static_scts in nginx configuration file.

ssl_ct on;  
ssl_ct_static_scts ssl/sct;

OCSP stapling

Here may some issues. for detail please read:


Using Let’s Encrypt certificate need not enable OCSP Stapling and ssl_trusted_certificate, because the OCSP service of Let’s Encrypt returned nothing.

Please make sure ssl_trusted_certificate has configured correctly when OCSP Response returned certificate information and configured ssl_stapling_verify on.

ssl_trusted_certificate need point to a file which included Root Certificate, Intermediate Certificate. If configured incorrectly, nginx will show error message in error log file.

It seems using fullchain for "ssl_trusted_certificate" doesn't work. That field should be the "Root CA and Intermediate certs", and should not include the site certificate.

So here is my configuration, If your certificate both issued by Let’s Encrypt, you can ignore ssl_stapling_verify and ssl_trusted_certificate.

ssl_stapling             on;  
ssl_stapling_verify      on;  
ssl_trusted_certificate ssl/all.zeroling.com.server-middle-root.crt;


When finished, you can test your configuration on ssllab.

In section of Handshake Simulation, If seem ECC and RSA shown on different device means your configuration has no problem and works fine.

Here is a report of zeroling.com




喜欢 (0)
Cancel Comment


Hi, We need some information

  • Nickname (*)
  • E-Mail (*)
  • Website