Answer the question
In order to leave comments, you need to log in
How to properly share rights on one VPS for several sites and users?
Good afternoon.
The problem is this:
We rented a good VPS in half with a friend. There will be several sites on the server. Half of the sites are mine, half are my friend's.
For security reasons, I want to correctly configure the nginx + php5-fpm bundle so that the owner of one site cannot access another site. Strongly no one is going to break into other people's folders, but the developer of another site hosted on the same VPS or someone who hacks any of the sites on the VPS can conditionally gain access to the site. I do not want to fence any virtualization, otherwise there is no point in dividing hosting into two.
So far I have a solution like this (but it solves only part of the problems).
For each site I create my own separate php5-fpm pool, hang it on a separate port and run it from a separate user.
For example:
[host1]
listen = 127.0.0.1:9001
user = user1
group = user1
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 4
...
chdir = /
php_admin_value[log_errors] = on
php_admin_value[upload_tmp_dir] = /var/www/$pool/mod-tmp/upload_tmp
php_admin_value[session.save_path] = /var/www/$pool/mod-tmp/sessions
php_admin_value[error_log] = /var/www/$pool/logs/php-errors.log
и т.п.
fastcgi_pass 127.0.0.1:9001; # - на один php пул, который работает от пользователя user1
fastcgi_pass 127.0.0.1:9002; # - на другой php пул, который работает от пользователя user2
Can't connect to local MySQL server through socket '/var/run/mysqld mysqld.sock' (2) [2002]
Answer the question
In order to leave comments, you need to log in
set the rights to files 640, directories 750 and owner user1:www-data, user2:www-data
in nginx group www-data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question