Wordpress permission issues using LEMP install on Ubuntu 12.04

March 24, 2014 1.8k views
Hi all, I used the tutorial over at https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04 to get a LEMP setup quickly up and running but I'm having troubles updating and using plugins that create files on the server (backup plugins). The php5-fpm process seems to be running under my user, should it be running using www-data? Any help would be much appreciated.
8 Answers
I should note, the specific error I am getting when trying to do anything is:

WARNING: wp-includes/functions.php:1378 - mkdir(): Permission denied
On my installation php5-fpm has 'www-data' as the user. Also my htdocs folder belong to the user 'www-data' and the permission is set to 755
In my www.conf file in /etc/php5/fpm/pool.d/ I have set the user to www-data yet for someone reason it's still running under my user.

Anyone have any ideas on how I can fix this?

sudo chown -R www-data:www-data /var/www

From what I understand.. The instruction in the article https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04

"Give ownership of the directory to the nginx user, replacing the "username" with the name of your server user.

sudo chown www-data:www-data * -R
sudo usermod -a -G www-data username"

reverts ownership to you as the user rather than www:data

try to revert it back to www-data.
by Etel Sverdlov
Wordpress is a free and open source website and blogging tool that uses php and MySQL. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality. This tutorial shows how to install Wordpress on a server with LEMP (with nginx instead of apache). It is written for Ubuntu 12.04.
Thanks for that leoadhemartan, so from what I understood of your reply, I ran:
sudo usermod -a -G www-data www-data
Which I'm assuming sets the ownership to the www-data user, however restarting the php5-fpm shows that my user is still the one running it (as opposed to www-data).

What am I doing wrong?
taking a wild guess..

are you using the Duplicator plugin?

I tried that on my first droplet a few months ago, I quit because of issues with PHP. I decided to manually upload the backup (ftp the files, load the db through mysql).


I am not, I'm using BackWPup. Regardless of plugin, I'm sure that the process running under the wrong user can cause problems and I'd like to try and fix it anyway if possible.
Can you pastebin php5-fpm's config file and the output of the following two commands?
sudo service php5-fpm restart

sudo ps wwaux | grep php5-fpm
Have another answer? Share your knowledge.