A Stone Bell

Deep and Sonorous, or maybe just a Dull Thud?


Running different websites as different users under Apache

My web server version is Apache/2.4.41 running under Ubuntu 19.10 , so first off, let’s install what’s Apache needs, the MPM (Multi-Processing Module) :

apt-get update
apt-get install libapache2-mpm-itk
a2enmod mpm_itk

That’s it, assuming you had a working Apache setup to start with. Then in the configuration files files for each of your sites put

AssignUserId www-data www-data

The If IfModule is just to ensure that the MPM is running and the first www-data is the user to run the website (for details on how to create a user see this) and the second the group so, of course, change it o the user you really want to run the site & then restart Apache.

And that’s it. You should be able to test it but putting a small script into site & running it from your browser, say a file called “info.php”:

When it runs you should see the user name you set in the configuration file

- No Comments on this Post -