wipeout wrote:
Currently I have 5 sites on my server.. I use apache with mod_fcgid to run php..
My typical setup till now involved creating a user account for each domain name with a public_html file in the home directory then through suexec running php as that user/group which meant file permissions were never an issue (my guess is this isn't the best in terms of security?)..
I use suEXEC because it is actually
more secure than having everything readable/writable by the apache user. This way each website/user can only write read/write from their own PHP files. This matters, especially since many PHP config scripts include a database username/password. I've never had a memory issue, but then my websites aren't massively busy. You can reduce the memory by a) reducing the number of PHP processes that fcgid spawns for each website, and b) reducing the PHP memory limit in php.ini.
If you don't like using suEXEC, what must people do is give each website its own user/group (as you have already done). The only change is that the folders/files which you would like PHP to be able to write to has to be world-writable.
wipeout wrote:
When files are uploaded from a website they will obviously have user and group permissions of www-data, how would I allows developers access to those files? Do you have to add the "site" users to the www-data group?
I've always used suEXEC so I haven't though of this before, I'm sure others will be able to help. What you could do is run a cron script to make sure the permissions of newly uploaded files are correct.