问题描述
我已经安装了rmagick的carrierwave gem。
如果试图使用nginx代替loadrro WEBrick,但得到500内部服务器错误,我可以很好地工作。
nginx error.log表示:
2011/08 / 14 10:06:40 [crit] 760#0:* 4247 open()/usr/local/Cellar/nginx/1.0.4/client_body_temp/0000000033失败(13:权限被拒绝),客户端:127.0.0.1, server:jewellery.dev,请求:POST / items / 28?locale = en HTTP / 1.1,主机:jewellery.dev:8080,referrer:http://jewellery.dev:8080/items/28/编辑?locale = en
另外,我在初始化文件夹中创建了一个文件,其中包含:
CarrierWave.configure do | config |
config.permissions = 0777
end
我错过了什么吗?
这与CarrierWave无关,Nginx无法在文件夹 / usr / local / Cellar / nginx / 1.0.4 / client_body_temp / 与临时上传的文件,这意味着你的Nginx进程没有权限。确保运行nginx的用户可以在这个特定路径下读/写文件,如果你没有改变配置,Nginx通常以用户 nobody 的形式启动它,所以你可以给他读/写访问权限
运行以下命令:
ps aux | grepnginx:worker process
并查看哪个用户正在运行nginx。
I've installed carrierwave gem with rmagick.
I can get it working fine if load thro WEBrick but getting 500 Internal Server Error when trying to use nginx instead.
The nginx error.log says:
2011/08/14 10:06:40 [crit] 760#0: *4247 open() "/usr/local/Cellar/nginx/1.0.4/client_body_temp/0000000033" failed (13: Permission denied), client: 127.0.0.1, server: jewellery.dev, request: "POST /items/28?locale=en HTTP/1.1", host: "jewellery.dev:8080", referrer: "http://jewellery.dev:8080/items/28/edit?locale=en"
Also I've created an file on initializers folder containing:
CarrierWave.configure do |config|
config.permissions = 0777
end
Am I missing something?
This is not related to CarrierWave, Nginx is not being able to write at the folder /usr/local/Cellar/nginx/1.0.4/client_body_temp/ with the temporary uploaded file, which means your Nginx process doesn't have rights on it. Make sure the user that's running nginx can read/write files under this specific path, if you have not changed the configuration, Nginx usually starts it's workers as user nobody so you might give him read/write acces to this folder.
Run the following command:
ps aux | grep "nginx: worker process"
And see which user is running nginx.
这篇关于Rails 3 + carrierwave + nginx =权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!