ssl port didnt work on nginx

Posted by Jin Lin on Super User See other posts from Super User or by Jin Lin
Published on 2013-10-27T23:59:29Z Indexed on 2013/10/28 9:56 UTC
Read the original article Hit count: 317

Filed under:
|

I set up the unicorn and nginx on one of my ec2 machine.

and my request are loading ok with nginx listen to port 80.

but when I enable it to ssl, which listen to port 443.

It doesn't work. and it can still work with port 80, https.

server {

listen 443 ssl;
# replace with your domain name
server_name domain.com;
# replace this with your static Sinatra app files, root + public 
root /home/ubuntu/domain/public;

ssl on;
ssl_certificate /etc/ssl/domain.crt;
ssl_certificate_key /etc/ssl/domain.key;
# maximum accepted body size of client request 
client_max_body_size 4G;
# the server will close connections after this time 
keepalive_timeout 5;

location ~ ^/assets/ {
  add_header ETag "";
  gzip_static on;
  expires max;
  add_header Cache-Control public;
}

location / {
  proxy_set_header X-Forwarded-Proto https;
  try_files $uri @app;
}

location @app {
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_redirect off;
  # pass to the upstream unicorn server mentioned above 
  proxy_pass http://unicorn_server;
}

}

© Super User or respective owner

Related posts about ssl

Related posts about nginx