I'd like to ask a question about LNMP stacks and user privilege separation.
I usually host websites on LNMP stacks and Wordpress on Debian 7 and 8 servers. I separate each Wordpress site into its own user. For example, /home/user1/www/html and /home/user2/www/html and so on.
Also, php5-fpm pools are run via these users, like user1, user2. Each of these pools are responsible for their own websites residing in ~/www/html. I'll show you an example of a pool.d file in /etc/php5/fpm/pool.d:
user = user1
group = user1
listen.owner = user1
listen.group = www-data
listen.mode = 0660
Nginx is run by www-data instead of nginx user.
I ended up with these configurations as earlier methods were giving me server errors on nginx and php's side, either time-outs,permissions or gateway errors. Sometimes wordpress would complain about being unable to write to the ~/www/html folder, which is the web root.
Is there a way better way than this? Is this overcomplicated?
Is this insecure?
I'm not an expert by any means, I've learned via diy, web search and reading, so I'd be glad to take some pointers before taking on bad habits in the long run.