Rails 3 + carrierwave + nginx = permission denied

时光怂恿深爱的人放手 提交于 2019-12-09 13:17:46

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/7054338/rails-3-carrierwave-nginx-permission-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!