Install mod_ruid2 on CentOS 6 with DirectAdmin


In this post, we will show you how to install mod_ruid2 on a CentOS 6 VPS with a DirectAdmin control panel. mod_ruid2 is a suexec module for Apache which takes advantage of POSIX.1e capabilities to increase performance and allows all requests to a domain to run as the domain owner instead of as the Apache user.


Comment out the lines starting with AliasMatch in the /etc/httpd/conf/extra/httpd-vhosts.conf file

~# sed -i '/AliasMatch*/ s/^/#/' /etc/httpd/conf/extra/httpd-vhosts.conf

Build PHP without POSIX support

~# cd /usr/local/directadmin/custombuild
~# mkdir -p custom/ap2/
~# cp configure/ap2/configure.php5 custom/ap2/

Open the custom/ap2/configure.php5 file and add –disable-posix

~# nano custom/ap2/configure.php5

Rebuld PHP using the following command

~# cd /usr/local/directadmin/custombuild
~# ./build php n

Install dependencies

libcap-devel is required and has to be installed before proceeding with the mod_ruid2 intallation.

~# yum -y install libcap-devel curl

Download and build the latest version of mod-ruid2

We will use cURL to download the latest mod_ruid2 version from Sourceforge

~# curl -L\?source\=files | tar jx
~# cd mod_ruid2*
~# apxs -a -i -l cap -c mod_ruid2.c

Add “RMode config” and “RUidGid apache access” to the httpd.conf file

~# sed -i '/Group apache/a \\n# Mod_ruid\nRMode config\nRUidGid apache access' /etc/httpd/conf/httpd.conf

Add “RUidGid webapps webapps” to the httpd-directories.conf file

sed -i '/<\/IfModule>/a \\tRUidGid webapps webapps' /etc/httpd/conf/extra/httpd-directories.conf

Change ownership of the /var/www/html directory

chown -R webapps:webapps /var/www/html/

Restart Apache

We need to restart Apache for the changes to take effect

~# /etc/init.d/httpd configtest
~# /etc/init.d/httpd restart

That’s it! We have successfully installed mod_ruid2 on CentOS 6 with DirectAdmin.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install mod_ruid2 on your VPS for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment

To prove you are human please solve the following *