# Ssl problems

**URL:** <https://www.ruby-forum.com/t/ssl-problems/217751>\
**Category:** NGINX\
**Created:** [March 11, 2012, 1:39pm UTC](https://www.ruby-forum.com/t/ssl-problems/217751 "2012-03-11T13:39:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [March 11, 2012, 1:39pm UTC](https://www.ruby-forum.com/t/ssl-problems/217751/1 "2012-03-11T13:39:07Z")

</div>

Hi List

I inherited the following setup:

nginx reverse caching proxy load balancing to two real servers. I am  
trying to get SSL working.

Here is my config:

++++++++++++++++++++++++++++++++++++++++++++  
upstream ssl-apache\_cluster {  
server 10.0.0.3:443;  
server 10.0.0.6:443;  
fair;  
}

server {  
listen 196.37.50.51:443;  
client\_max\_body\_size 5M;  
client\_body\_buffer\_size 128k;  
server\_name######################;  
access\_log /var/log/nginx/##########.access.log;

```
    ssl on;
    ssl_certificate /etc/nginx/ssl/#########.crt;
    ssl_certificate_key /etc/nginx/ssl/domain.key;
    ssl_session_cache shared:SSL:10m;

```

location / {  
access\_log off;  
proxy\_set\_header X-Forwarded-Host $host;  
proxy\_set\_header X-Forwarded-Server $host;  
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\_pass https://ssl-apache\_cluster;  
}  
location ~\*  
.(jpg|jpeg|peg|PEG|gif|png|bmp|flv|pdf|ps|doc|mp3|wmv|wma|wav|swf|JPG|BMP|GIF|PNG|JPEG|ogg|mpg|mpeg|mpg4|zip|bz2|rar|xls|docx|avi|djvu|mp4|rtf|ico)$  
{  
root /var/www/jmredev;  
expires 60;  
slowfs\_cache fastcache;  
slowfs\_cache\_key $uri;  
slowfs\_cache\_valid 7d;  
access\_log off;  
}

```
    location ~* \.(css|js)$ {
            root /var/www/jmredev;
            expires 60;
            slowfs_cache fastcache;
            slowfs_cache_key $uri;
            slowfs_cache_valid 5m;
           access_log off;
    }

```

location ~\* .(mjs|mcss)$ {  
set $domain www.j########; # Change this to your site’s  
domain name  
set $root\_fcgi /var/www/fastcache/; # Change this to the public  
root  
folder of your site  
set $root\_cache /var/cache/nginx/minified; # Change this to a  
folder in which to cache the minified files  
set $min\_dir /usr/local/nginx/minify/min; # Change this  
folder  
to wherever you put the Minify files

include fastcgi\_params;  
fastcgi\_param SITE\_ROOT $root\_fcgi;  
fastcgi\_param SCRIPT\_FILENAME $min\_dir/minifier.php;  
fastcgi\_param PATH\_INFO minifier.php;  
fastcgi\_param SERVER\_NAME $domain;  
fastcgi\_param CACHE\_DIR $root\_cache;

root $root\_cache;

expires max;

gzip\_static on; # You will need to have installed Nginx using the  
–with-http\_gzip\_static\_module flag for this to work  
gzip\_http\_version 1.1;  
gzip\_proxied expired no-cache no-store private auth;  
gzip\_disable “MSIE [1-6].”;  
gzip\_vary on;

# If there is not already a cached copy, create one

if (!-f $request\_filename) {  
root $root\_fcgi;  
fastcgi\_pass 127.0.0.1:9000;  
}  
}

```
    location ^~ /blog/sites/default/files/ {
            proxy_redirect off;

            access_log off;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For 

```

$proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_pass https://ssl-apache\_cluster;  
}

}

===========================================================================

When I try and start NGINX I get the following error:

reloading nginx configuration: nginx: [emerg] unknown directive “ssl” in  
/etc/nginx/sites-enabled/j#########l\_ssl:21

And this error in the browser:

SSL received a record that exceeded the maximum permissible length.

(Error code: ssl\_error\_rx\_record\_too\_long)

I am running Ubuntu server 10.04.2 LTS and NGINX 10.0.3

Many thanks

Lawrence

---

<div class="post-metadata">

**Author:** ![Lawrence\_Strydom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eada6e/32.png) [@Lawrence\_Strydom](https://www.ruby-forum.com/u/Lawrence_Strydom)\
**Post date:** [March 11, 2012, 1:43pm UTC](https://www.ruby-forum.com/t/ssl-problems/217751/2 "2012-03-11T13:43:28Z")

</div>

On 3/11/12 8:38 AM, Lawrence Strydom wrote:

> upstream ssl-apache\_cluster {  
> access\_log /var/log/nginx/##########.access.log;  
> proxy\_set\_header X-Forwarded-Server $host;  
> slowfs\_cache fastcache;  
> slowfs\_cache\_valid 5m;  
> folder in which to cache the minified files  
> root $root\_cache;
> 
> # If there is not already a cached copy, create one
> 
> ```
> access_log off;
> 
> ```
> 
> ===========================================================================
> 
> When I try and start NGINX I get the following error:
> 
> reloading nginx configuration: nginx: [emerg] unknown directive “ssl” in  
> /etc/nginx/sites-enabled/j#########l\_ssl:21

Most likely nginx is built without ssl.

What’s the output of nginx -V ?

> Many thanks
> 
> Lawrence

–  
Jim O.
