# Nginx use ssl slow than ELB

**URL:** <https://www.ruby-forum.com/t/nginx-use-ssl-slow-than-elb/243595>\
**Category:** NGINX\
**Created:** [December 8, 2015, 3:04pm UTC](https://www.ruby-forum.com/t/nginx-use-ssl-slow-than-elb/243595 "2015-12-08T15:04:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [December 8, 2015, 3:04pm UTC](https://www.ruby-forum.com/t/nginx-use-ssl-slow-than-elb/243595/1 "2015-12-08T15:04:19Z")

</div>

Hi,

I want to use nginx as LB to replace aws ELB, but found that it is much  
slower, it affected web users, sometime user will encounter access web  
time  
out.

this is my configuration, please help to check if something is wrong. I  
use  
ssl.

user nginx;  
worker\_processes auto;  
worker\_rlimit\_nofile 65535;

error\_log /var/log/nginx/error.log warn;  
pid /var/run/nginx.pid;

events {  
use epoll;  
worker\_connections 65535;  
}

http {  
include /etc/nginx/mime.types;  
default\_type application/octet-stream;

```
log_format main '$remote_addr - $remote_user [$time_local] 

```

“$request”  
’  
'$status $body\_bytes\_sent “$http\_referer” ’  
‘“$http\_user\_agent” “$http\_x\_forwarded\_for”’;

```
access_log /var/log/nginx/access.log main buffer=1m flush=5s;

sendfile on;
keepalive_timeout 60;
client_max_body_size 0;

server {
listen 8080;
root /usr/share/nginx/html;

location = /nginx_status {
    stub_status on;
    access_log off;
}

location = /status.html {
}
}

include /etc/nginx/test.d/test.conf;

```

}

test.conf:  
ssl\_session\_cache shared:SSL:10m;  
ssl\_session\_timeout 30m;  
upstream backend {

```
    server x.x.x.x;
    server x.x.x.x;
    check interval=30000 rise=3 fall=5 timeout=5000 type=http;
    check_http_send "HEAD /healthcheck HTTP/1.0\r\n\r\n";

```

}

server {  
listen 80;  
listen 443 ssl;

```
 location / {
    proxy_pass http://backend;

}
keepalive_timeout 60;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffers 128 16k;
client_body_buffer_size 2048k;
underscores_in_headers on;
ssl_certificate ssl/chained.crt;
ssl_certificate_key ssl/key.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers

```

‘ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!DH:!EDH’;  
#ssl\_ciphers HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;  
ssl\_prefer\_server\_ciphers on;  
}

Posted at Nginx Forum:

> **[Nginx use ssl slow than ELB](https://forum.nginx.org/read.php?2,263347,263347#msg-263347)**
>
> Hi, I want to use nginx as LB to replace aws ELB, but found that it is much slower, it affected web users, sometime user will encounter access web time out. this is my configuration, please help to check if something is wrong. I use ssl. user nginx;
