新手问题 Carrierwave 上传到 AWS S3 报错, 生产环境

springwq · 2014年12月22日 · 最后由 springwq 回复于 2014年12月24日 · 2360 次阅读

我的这个项目跑在本地上好的,可以正常上传文件到 S3, 但是部署到 Ubuntu 14.04 的 VPS 之后,上传功能就出问题了。

https://github.com/springwq/photo_store

这是 production.log

1378 I, [2014-12-22T11:10:38.603482 #9603]  INFO -- : Started POST "/admin/images" for 58.247.17.193 at 2014-12-22 11:10:38 +0800
1379 I, [2014-12-22T11:10:38.604527 #9603]  INFO -- : Processing by Admin::ImagesController#create as HTML
1380 I, [2014-12-22T11:10:38.604633 #9603]  INFO -- :   Parameters: {"utf8"=>"✓", "authenticity_token"=>"+gM5W9BJBSep+g5woBi/sD7vS/GRxjN>
1381 I, [2014-12-22T11:10:44.860865 #9603]  INFO -- : Completed 500 Internal Server Error in 6256ms
1382 F, [2014-12-22T11:10:44.862269 #9603] FATAL -- :.
1383 Excon::Errors::BadRequest (Expected(200) <=> Actual(400 Bad Request)
1384 excon.error.response
1385   :body          => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AuthorizationHeaderMalformed</Code><Message>The autho>
1386   :headers       => {
1387     "Connection"       => "close"
1388     "Content-Type"     => "application/xml"
1389     "Date"             => "Mon, 22 Dec 2014 03:10:43 GMT"
1390     "Server"           => "AmazonS3"
1391     "x-amz-id-2"       => "DQ/eYeymGOTdePU0hOjf/Nfygqw6ZFMPwhkw80BXyIT56SI7JPAW/nuRuE2r9hlL"
1392     "x-amz-request-id" => "0B88D93FCA879D41"
1393   }
1394   :local_address => "106.185.29.213"
1395   :local_port    => 52079
1396   :reason_phrase => "Bad Request"
1397   :remote_ip     => "54.231.32.137"
1398   :status        => 400
1399 ):
1400   app/controllers/admin/images_controller.rb:11:in `create'

看一下这个 thread,可能有帮助 https://github.com/fog/fog/issues/3275

#1 楼 @lgn21st 问题还没解决,现在 403 了,提示 AWS ACCESS KEY 和系统不匹配,貌似 AWS 跟的 KEY 管理方法和以前不一样了,还在学习中。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号