Search code examples
linuxnginxfile-permissionsunicorn

Write error when trying to run unicorn: directory for pid=/var/www/twimpush/pids/unicorn.pid not writable (ArgumentError)


I've followed the steps in the DigitalOcean guides here and here towards setting up a Sinatra server using nginx and Unicorn. I'm on the second to last step:

start the Unicorn and run it as a daemon using the configuration file: Make sure that you are inside the application directory i.e. /my_app

unicorn -c unicorn.rb -D

Running that command, I get the error:

directory for pid=/var/www/twimpush/pids/unicorn.pid not writable (ArgumentError)

I've tried this as both root, and as a user called deployer, to which I gave write permissions.


Solution

  • When I cloned my git repo, it didn't include the empty pids folder inside my repo. I added it with mkdir pids, in addition to the other required folders mentioned in the first guide, and it worked.