Nginx SSL 配置缓慢

Nginx SSL 配置缓慢

我的 SSL 配置有些慢,这方面存在一些问题。通常,当我通过 HTTP 连接时,我的网站响应时间不到 125 毫秒,但通过 HTTPS 连接时响应时间超过 400 毫秒。我尝试调整配置,但老实说,我不知道获得快速连接的最佳方法是什么。任何帮助或指导都将不胜感激

站点配置

upstream backend  {
    least_conn;

    server 10.132.42.217:3000;
    server 10.132.39.94:3000;
    server 10.132.66.78:3000;
}

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443;
    server_name example.com;

    ssl on;
    ssl_certificate /etc/ssl/example/2017/ssl-bundle.crt;
    ssl_certificate_key /etc/ssl/example/2017/server.key;
    ssl_session_timeout 30m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS:!DH;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:30m;

    client_max_body_size 500M;

    location /static/ {
            autoindex on;
        root /var/www/example/example/public/;
    }

    location / {
        proxy_pass http://backend;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        add_header X-Nginx-Server 'nginx1';
        add_header X-Upstream $upstream_addr;
    }
}

如果您需要更多信息,请告诉我。

相关内容