Extremely slow Nginx download over ssl

Posted April 3, 2016 5.5k views

i have a 512 Mb droplet and ngnix 1.9.5 , Nginx is as slow as HELL when accessed with HTTPS , it wasn’t like that sometime ago , i’ve applied my current configuration to another VPS i have and it worked smoothly i tried to reboot the droplet , but no still no luck .
i don’t know exactly what’s the problem , i’m using the default Nginx SSL configuration and tried a few more all didn’t work , i also checked the droplet resources usage it’s okay , i’m trying to access it with curl , browsers anything it’s so slow .
however if i accessed the same url with HTTP it works without a doubt .

Here’s my configs

    server {
server_name ;
listen 80 ;
listen [::]:80 ;
#listen 443 ssl ;
  listen               *:443 ssl http2 ;
  listen               [::]:443 ssl http2 ;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_session_timeout 10m;
ssl_session_cache   shared:SSL:10m;
ssl_certificate /etc/nginx/ssl/admin.crt;
ssl_certificate_key /etc/nginx/ssl/admin.key;

root /var/www/admin/public/;
index index.php index.html index.htm;
access_log /var/www/admin/admin.log;
auth_basic "Top Secret";
auth_basic_user_file /var/www/admin/.htpasswd;

        location / {
try_files $uri $uri/ =404;
#deny all;

location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.0-fpm.admin.sock;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;



Again , i’ve tried many many SSL configuration including the Nginx default ones .
currently i’ve 4 Vhosts with estimated 10 visitors per day and CPU usage never exceeded 12%

1 comment
  • okay after some researching i figured out that if i take an image of exactly the same VPS and applied it to one which is in a server closer to me (Frankfurt instead of NY ) that it gets it way faster . is it a distance problem then ? if so why HTTP is 10x faster than HTTPS ! ?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

We’re glad you had a speed increase by using a closer datacenter. HTTPS is a little slower than HTTP because it is an encrypted standard of communication, so the data being sent needs to be encrypted first by SSL, and is often not cached.