How to use different user and group for just one Virtual Host in Apache
On June 13, 2014 by Gerson Barreiros With 0 Comments - SysAdmin, Ubuntu
With the mpm-itk that is a multi-processing module (MPM) you can run each virtualhost with it’s own user id and group id. This is basically used to make a shared hosting secured, since you don’t have to make all virtualhosts folders readeable by apache user.
mpm-itk is based on the traditional prefork MPM, which means it’s non-threaded; in short, this means you can run non-thread-aware code (like many PHP extensions) without problems.
sudo apt-get install libapache2-mpm-itkHow the virtual host should be configured:
ServerName example.com DocumentRoot /path/to/web/root AssignUserId vhost-user vhost-groupIt is good to change website root to be owned by the user and the group set to the vhost, change it with
sudo chown -R vhost-user:vhost-group /path/to/webrootTake care with this command, this will change all owner and group of your files in the specified path.And finally start Apache
sudo service apache2 restartSource: IT Solution
Comments are Disabled