Apache run web site as user with mod_ruid2
mod ruid2 allow you to run web site as differnt user from the one web server is running. This is helpfull when you have multiple web sites on same Apache web server.
To install mod_ruid2 on Ubuntu/Debian server, run
1 |
apt install libapache2-mod-ruid2 |
Edit VirtualHost entry for the web site, add
1 2 |
RMode config RUidGid USERNAME_HERE GROUP_HERE |
Restart Apache
1 |
systemctl restart apache2 |
Now website will run as user specified in line
1 |
RUidGid USERNAME_HERE GROUP_HERE |
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
root@create:~# cat /etc/apache2/sites-enabled/serverok.in.conf <VirtualHost *:80> ServerName serverok.in ServerAdmin admin@serverok.in DocumentRoot /home/serverok.in/html CustomLog ${APACHE_LOG_DIR}/serverok.in.log combined ErrorLog ${APACHE_LOG_DIR}/serverok.in-error.log <Directory "/home/serverok.in/html"> RMode config RUidGid serverok serverok Options All AllowOverride All Require all granted Order allow,deny allow from all </Directory> </VirtualHost> root@create:~# |
See Apache