Question

Using Rails 3.1 with the paperclip gem on nginx I get the following 500 error when attempting to upload images:

Permission denied - /webapps/my_rails_app/public/system

Observing the guidance offered elsewhere on this issue, I have modified my directory permissions such that

drwxr-xr-x 3 www-data www-data 4096 Mar 10 17:57 system

And, it would appear, this permission structure is maintained for all public sub-directories.

Yet, having restarted nginx, the error persists.

Do I need to modify nginx.conf or take another hack at permissioning the affected directory?

Was it helpful?

Solution

When I've run into this in the past, it's generally because the Rails application was started by a user or process that is not a part of the www-data group, and is not the www-data user. I'd first check to confirm that the www-data is in fact running your app.

This can be done using ps awwwx and perhaps some grep logic to find your app in the process stack.

I might suggest that you change the directory permissions to allow any member of the www-data group to write to the directory as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top