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

apt install libapache2-mod-ruid2

Edit VirtualHost entry for the web site, add

RMode config
RUidGid USERNAME_HERE GROUP_HERE

Restart Apache

systemctl restart apache2

Now website will run as user specified in line

RUidGid USERNAME_HERE GROUP_HERE

Example

root@create:~# cat /etc/apache2/sites-enabled/serverok.in.conf 

    ServerName serverok.in
    ServerAdmin [email protected]
    DocumentRoot /home/serverok.in/html
    CustomLog ${APACHE_LOG_DIR}/serverok.in.log combined
    ErrorLog ${APACHE_LOG_DIR}/serverok.in-error.log
    
        RMode config
        RUidGid serverok serverok
        Options All
        AllowOverride All
        Require all granted
        Order allow,deny
        allow from all
    

root@create:~# 

See Apache

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *