Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 + carrierwave + nginx = permission denied

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?

like image 259
Kleber S. Avatar asked Aug 14 '11 01:08

Kleber S.


1 Answers

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.

like image 59
Maurício Linhares Avatar answered Oct 02 '22 09:10

Maurício Linhares