linuxapacheapache2vhostsownership

How to execute Apache2 virtual server under different user/group with mpm_event


I want to host a multisite server with different user/group for each site like :

/var/www/site0 = user0:groupuser0
/var/www/site1 = user1:groupuser1

I didn't find a way to change file ownership with specific group/user including/included www-data.

Everytime I execute phpinfo() it run as www-data for uid and gid.

I have see there is mod_itk and mod_privileges but it do not work with mpm_event to have HTTP/2 running on the webserver (very important for performance).

So i'm asking here expert if there's a way to do it with mpm_event.


Solution

  • Finally I have found the answer.

    It was about php execution.

    You can set specific user group by creating specific php-fpm execution pool located in

    /etc/php/8.2/fpm/pool.d
    

    Then the uid/gid can be correctly containerized inside the system.