SSL on nginx + unicorn got "Error 102 (net::ERR_CONNECTION_REFUSED)"

Posted by panggi on Server Fault See other posts from Server Fault or by panggi
Published on 2012-06-13T04:36:49Z Indexed on 2012/06/13 4:41 UTC
Read the original article Hit count: 658

Filed under:
|
|
|
|

I tried to deploy my app on EC2 (opened port: 22, 80, 443)

App: Rails 3.2.2

Server:

  • nginx 1.2.1
  • unicorn gem (latest)
  • ubuntu 12.04

Deployer: Capistrano

I tried to follow the instruction in Railscasts : http://railscasts.com/episodes/335-deploying-to-a-vps (Sorry, it's a Pro Episode)

Anything fine with normal port 80 http but i got Error 102 after trying to use SSL, here is the nginx.conf content:

    upstream unicorn {
      server unix:/tmp/unicorn.frontend.sock fail_timeout=0;
    }

    server {
    server_name  beta.sukeru.com;
    listen       443 default;

    root /home/deployer/apps/appname/current/public;

    ssl                  on;
    ssl_certificate      server.crt;
    ssl_certificate_key  server.key;

    ssl_session_timeout  5m;

    ssl_protocols  SSLv2 SSLv3 TLSv1;
    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    location / {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_redirect off;
    proxy_pass http://unicorn;
    }

    error_page 500 502 503 504 /500.html;
    }

In production.rb i set:

    config.force_ssl = true

Can anyone give a solution for this? :)

© Server Fault or respective owner

Related posts about ubuntu

Related posts about nginx