From 3bc8639992ce4bed72f2c44481ee327ad000074a Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Mon, 15 Nov 2010 10:59:09 -0800 Subject: [PATCH] added ssl support in nginx template for chef --- .../common/templates/default/nginx.conf.erb | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/chef/cookbooks/common/templates/default/nginx.conf.erb b/chef/cookbooks/common/templates/default/nginx.conf.erb index 133f971f4..059d9c271 100644 --- a/chef/cookbooks/common/templates/default/nginx.conf.erb +++ b/chef/cookbooks/common/templates/default/nginx.conf.erb @@ -41,7 +41,7 @@ http { listen 80; server_name alpha.joindiaspora.com www.alpha.joindiaspora.com; - root /usr/local/app/diaspora/public; + root /usr/local/app/diaspora/public; location / { proxy_set_header X-Real-IP $remote_addr; @@ -50,7 +50,36 @@ http { proxy_redirect off; proxy_buffering off; - if (-f $request_filename/index.html) { #Something here is for photos, but do we need it all? + if (-f $request_filename/index.html) { + rewrite (.*) $1/index.html break; + } + if (-f $request_filename.html) { + rewrite (.*) $1.html break; + } + if (!-f $request_filename) { + proxy_pass http://thin_cluster; + break; + } + } + + server { + + listen 443; + server_name alpha.joindiaspora.com www.alpha.joindiaspora.com; + root /usr/local/app/diaspora/public; + + ssl on; + ssl_certificate /usr/local/nginx/conf/joindiaspora.crt; + ssl_key /usr/local/nginx/conf/joindiaspora.key; + + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_buffering off; + + if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } if (-f $request_filename.html) {