状态代码500 Paperclip amazon s3连接被拒绝 - (连接被拒绝 - 连接(2)为“bucket.s3.amazonaws.com”端口443

时间:2015-04-01 16:51:57

标签: ruby-on-rails amazon-web-services amazon-s3 paperclip

Paperclip似乎无法连接到我的amazon s3存储桶实例,它会出现此错误 -

*** Exception Errno::ECONNREFUSED in Rack application object (Connection refused - connect(2) for "bucket-images-test.s3.amazonaws.com" port 443) 

我的production.rb看起来像这样:

config.paperclip_defaults = {
      :storage => :s3,
      :s3_credentials => {
          :bucket => 'bucket-images',
          :access_key_id => 'accesskey',
          :secret_access_key => 'seceretkey',
           :host_name => 's3-website-us-east-1'
      },
      :default_url => "/missing.png",
      :path => "/:attachment/:id/:style/:filename",
      :url => "/:attachment/:id/:style/:filename"
  }

我正在使用:

  • paperclip version 4.2.0
  • aws-sdk version 1.63
  • aws-sdk-resources version 2

1 个答案:

答案 0 :(得分:1)

问题在于宝石和iptables 的Gemfile

gem 'paperclip', '~> 4.2.0'
gem 'aws-sdk', '~> 1.5.8'
gem 'aws-sdk-resources '~> 2'

我也阻止了端口443所以我不得不改变iptables:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:http

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http