-1

I have a server running multiple websites (mostly WordPress) and want to separate them from each other so I can give a person access to one site and not the others, and also so any code run on each site cannot access the other sites. I feel as though the answer is in separate user accounts but I'm not sure what to search for to find tutorials.

My current setup is - LEMP Stack on Ubuntu. All sites in their own directory under /var/www/sites/ where everything is owned by www-data. They all share an instance of mysql though with different mysql users for each site. I only have one user for the server who is non root with sudo privileges.

patnz
  • 117
  • 5
  • If you have an answer, please post it as an answer, not as part of your question. Thanks! – EEAA May 20 '15 at 02:52

3 Answers3

2

To get started, check out What permissions should my website files/folders have on a Linux webserver? - I'm not certain what specific tweaks to that you might need to do when using nginx instead of Apache, but I think that post and the answer(s) will give you a good foundational understanding.

g491
  • 973
  • 5
  • 7
1

The solution I needed was:

  • have different website files placed under different user accounts i.e. home/USER/website instead of all under var/www/. These files should be owned by that user as opposed to www-data or similar.
  • Configure Nginx hosts to point to the new location for each site.
  • Configure PHP to run as a specific user for the sites under that users account - more info.

This keeps files separate for each user, assuming you have correct permissions configured, and also allows php to rwx since php process is running as the same user the files are owned by.

patnz
  • 117
  • 5
-2

I think you can use listen in nginx to listen to different ports, so that you can visit your website via different ports.

technoob
  • 142
  • 1
  • 14