Nginx – WordPress – Capistrano Permissions Issues

capistranonginxWordpress

I'm managing a WordPress install with Capistrano and Composer. Everything is setup and working well, its quite fast on my ngix / php-fpm setup.

However, I ran into an issue when attempting to update plugins from the admin area, WordPress asks for FTP credentials. A quick google, and its clear this is because WordPress can access web services on my server.

I SSD'd into my server and did the following:

ps aux | grep 'nginx'

nginx is running under the www-data user. That's normal.

Here's my problem: to use Capistrano you create a deploy user and give them passwordless sudo priviledges. Ok fine. I did that. Capistrano works well.

Problem is the files have to be owned by this deploy user. To do that I just chown like so:

sudo chown -R deploy:www-data /srv/www/mysite.com

After that I wanted to make sure all new files and directories inherit the group ownership:

sudo chmod g+s /srv/www/mysite.com

This way when capistrano adds new files they all inherit the correct permissions.

I also added the deploy user to the www-data group in an attempt to avoid the problem I'm having with WordPress.

I confirmed this by running groups deploy

When I recursively chown the directory to www-data:www-data everything works fine. I can update and download plugins from the backend BUT I can't deploy with Capistrano.

What do I have to do to nginx access to my wordpress install and solve this problem?

Thanks.

Best Answer

Sounds like you may have forgotten to give group write permissions:

$ sudo chmod g+w /srv/www/mysite.com
Related Topic