使用Rails,Carrierwave,Amazon EC2上传图片时Errno :: EPERM(不允许操作FILE_PATH) [英] Errno::EPERM (Operation not permitted FILE_PATH) when uploading image with Rails, Carrierwave, Amazon EC2

查看:177
本文介绍了使用Rails,Carrierwave,Amazon EC2上传图片时Errno :: EPERM(不允许操作FILE_PATH)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在生产中遇到错误,导致我无法使用Rails和Carrierwave将图像上传到Amazon EC2。



该应用程序在我的本地开发服务器上完美工作,但是在生产中,我收到了这个错误

 在6319ms内完成了500个内部服务器错误

Errno :: EPERM(操作不允许 - / FILE / PATH / TO / IMAGE / DESTINATION):

我检查了目标文件是否具有所有正确的权限。这是上传目录,我确信整个目录是可读,可写和任何人都可以执行的。

  ** [] lrwxrwxrwx。 1 foo rvm 50 10月3日10:53上传

任何人都知道发生了什么事情?

解决方案

这是由权限问题导致的。我们的Rails应用程序使用Amazon EC2,Capistrano进行部署,并使用多级扩展进行生产和临时环境。

在我们转向多级扩展之前,其中一个贡献者拥有整个rails应用程序,让我们称他为foo。一旦我们实现了多阶段,我们决定移动整个应用程序来使用一个名为appuser的全球用户。问题是许多上传仍然由foo所有。这是造成写入问题。

将所有上传的所有权更改为正确的用户和组,解决了问题。

I am getting an error in production that is preventing me from uploading an image to Amazon EC2 using Rails and Carrierwave.

The application works perfectly on my local development server, but in production I am getting this error

Completed 500 Internal Server Error in 6319ms

Errno::EPERM (Operation not permitted - /FILE/PATH/TO/IMAGE/DESTINATION):

I checked to make sure that the destination file has all the correct permissions. It is the upload directory, which I made sure that the entire directory was readable, writable and executable by anyone.

 ** [] lrwxrwxrwx.  1 foo rvm   50 Oct  3 10:53 uploads

Anyone know whats going on?

解决方案

This was caused by a permissions issue. Our rails app uses Amazon EC2, Capistrano for deployment and multistage extension for production and staging environments.

Before we moved to multistage extension one of the contributors owned the entire rails app, lets call him "foo". Once we implemented multistage, we decided to move the entire app to use a global user called "appuser". The problem is that many of the uploads were still owned by foo. This was causing write issues.

Changing ownership of all uploads to the proper user and group fixed the issue.

这篇关于使用Rails,Carrierwave,Amazon EC2上传图片时Errno :: EPERM(不允许操作FILE_PATH)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆