I have a Rails 4.1.4 application running on Nginx, Phusion Passenger, Postgresql, and Arch Linux. I'm deploying with Capistrano.
In my Rails application I am trying to upload an image via the Paperclip gem. By default Paperclip stores images in
/public/system. I don't want that directory to be overwritten when I redeploy, so in my
deploy.rb I've got it set as a linked directory:
set :linked_dirs, fetch(:linked_dirs, ).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads', 'public/documents')
Now, when I go to one of my forms and attempt to upload the image, I receive a 500 internal server error from Nginx. Checking the Nginx
error.log, it reports:
2016/08/10 14:55:56 [crit] 636#0: *2 open()
"/home/rserver/nginx/client_body_temp/0000000002" failed (13:
Permission denied), ...
2016/08/10 14:55:56 [alert] 636#0: *2 Cannot stat
'/home/rserver/nginx/config.ru': Permission denied (errno=13); This
error means that the Nginx worker process (PID 636, running as UID 99)
does not have permission to access this file. Please read this page to
learn how to fix this problem:
Extra info, ...
Now, I've gone to the provided url. In summary, it says that the relevant folders do not have executable permissions, and so I need to add them. However, after I follow that instruction, there is no difference in outcome:
drwxr-xr-x 11 rserver rserver 4096 Jun 25 13:38 nginx
I did the same for my application's folder in
drwxr-xr-x 5 rserver root 4096 Aug 10 14:31 polyov
Now, I've seen this question, and followed it. The user running nginx and whatnot is called
rserver, so I modified
nginx.conf and added:
However a Passenger then Nginx then system restart have not solved the problem- the Nginx worker process is still run by
nobody and I still cannot upload files.