Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

App: Rails 3.2.2


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

Deployer: Capistrano

I tried to follow the instruction in Railscasts : (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.appname.sock fail_timeout=0;

    server {
    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? :)


Log file added :

share|improve this question
Has nginx been restarted since that config was put in place? And is it listening properly on port 443? Anything in the error log? – Shane Madden Jun 13 '12 at 4:39
yes, i restarted nginx.. this is the log file >> – panggi Jun 13 '12 at 5:06
Can you check if it's listening on 443? netstat -nl | grep :443? – Shane Madden Jun 13 '12 at 5:30
it's running already, thanks.. i think, it's because i accessed it using instead of the real IP, because the is not pointed yet to this IP and also the full path of certificate :D that's my guess.. because it's misteriously running well :D – panggi Jun 13 '12 at 6:58
up vote 0 down vote accepted

I see you are forcing unicorn to work over https but when proxying you use http. Does this issue persists when unicorn is configured without ssl support?

share|improve this answer
This issue is not happened in http, and as i quoted in the code above, it's 443 by default.. but yes, before that i still have http configuration in my nginx.conf, so maybe it's still have effect when i switched to https.. but it's now working :D thanks for the respond :) – panggi Jun 13 '12 at 7:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.