diff --git a/chef/cookbooks/common/files/default/thins.yml b/chef/cookbooks/common/files/default/thins.yml index 1b981d300..37ec634b3 100644 --- a/chef/cookbooks/common/files/default/thins.yml +++ b/chef/cookbooks/common/files/default/thins.yml @@ -2,6 +2,8 @@ thins: - port: '3001' - port: '3002' - port: '3003' -url: 'alpha.joindiaspora.com' +url: 'joindiaspora.com' cert_location: '/usr/local/nginx/conf/diaspora.crt' key_location: '/usr/local/nginx/conf/diaspora.key' +s3_bucket: "https://joindiaspora.s3.amazonaws.com" +s3_path: "/uploads/images/' diff --git a/chef/cookbooks/common/recipes/nginx.rb b/chef/cookbooks/common/recipes/nginx.rb index aa07b168e..df2b41aa2 100644 --- a/chef/cookbooks/common/recipes/nginx.rb +++ b/chef/cookbooks/common/recipes/nginx.rb @@ -29,5 +29,6 @@ end config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml") template "/usr/local/nginx/conf/nginx.conf" do source "nginx.conf.erb" - variables :ports => config['thins'].map{|thin| "#{thin["port"]}"}, :url => config['url'], :cert_location => config['cert_location'], :key_location => config['key_location'] + variables :ports => config['thins'].map{|thin| "#{thin["port"]}"}, :url => config['url'], :cert_location => config['cert_location'], :key_location => config['key_location'], + :s3_bucket => config['s3_bucket'] , :s3_path => config['s3_path'] end diff --git a/chef/cookbooks/common/templates/default/nginx.conf.erb b/chef/cookbooks/common/templates/default/nginx.conf.erb index a8aa121ec..c038d82c9 100644 --- a/chef/cookbooks/common/templates/default/nginx.conf.erb +++ b/chef/cookbooks/common/templates/default/nginx.conf.erb @@ -109,7 +109,9 @@ http { break; } - rewrite ^/uploads/images/(.*)$ https://joindiaspora.s3.amazonaws.com/uploads/images/$1 permanent; + <% unless @s3_bucket.blank? || @s3_path.blank? %> + <%= "rewrite ^/uploads/images/(.*)$ #{@s3_bucket}#{@s3_path}$1 permanent; %> + <% end %> } error_page 500 502 503 504 /50x.html;