When running multiple websites on same server:


What should be done to make these websites run intependently - I mean to completely restrict access of PHP (or any other scripting language) to the root folder and each other's folders?

I am thinking of Apache Virtual Host, but will it restrict file access between each vhost as required?

<VirtualHost *:80>
    DocumentRoot "/root/website1/"
    ServerName Website1

<VirtualHost *:80>
    DocumentRoot "/root/website2/"
    ServerName Website2

<VirtualHost *:80>
    DocumentRoot "/root/website3/"
    ServerName Website3
  • What do you mean by "run independently"? – Michael Hampton Jan 2 at 18:18
  • To not have access to each other on the file system. – acoder Jan 2 at 18:22

You can create one PHP-FPM pool per website, each one running under a different user and group.

See there: https://www.digitalocean.com/community/tutorials/how-to-host-multiple-websites-securely-with-nginx-and-php-fpm-on-ubuntu-14-04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.