I have recently purchased a QuickSSL certificate from GeoTrust, and I am using it on NGINX. Everything is fine, but there is a nasty second before the page actually loads.
If I look at other SSL websites, most of them load instantly like it should.
This is my SSL configuration:
ssl on;
ssl_certificate /usr/local/nginx/ssl/www.crt;
ssl_certificate_key /usr/local/nginx/ssl/www.key;
I found about adding ssl
at the end of the listen
directive, but it has not solved it.
For this problem to reproduce I have to close the website and revisit it later (about 15 minutes?).
SSL handshake is a slow, 3 packet event. That means initial connection will take longer than non-SSL connection - usually 3-4 times longer. Following requests will use SSL session from 1st connection and will be faster, but only as long as the session stays alive.
You can control lifetime of SSL session in NGINX by setting
ssl_session_cache
andssl_session_timeout
.Edit: just noticed I have explained why it happens, but not what you can do about it. The answer is sadly very little. How long the initial handshake takes depends on 2 factors: time taken by the actual SSL cryptography (negligible with current hardware) and time taken by the 3 packet exchange which depends only on the network - unless you can get "lower ping" to the server nothing will change.
That sounds an awful lot like you've got SSL session caching turned on (the 15 minute wait to make the problem reappear), and either a really slow CPU or horribly latent network path between you and the server, which is causing the problem.