WebHostingPeople Blog

  • Domains
    • Shared Hosting

  • Cloud VPS
  • Servers
    • Client Area Login

How Can We Help?

Install mod_ruid2 on DirectAdmin

You are here:

 

Configure mod_ruid2 on DirectAdmin

The mod_ruid2 is a suexec module for Apache web server that leverages POSIX for improved performance and enhanced security for hosted websites. By using mod_ruid2, websites load faster and overall security is improved. This module ensures that PHP processes are executed under the ownership of the user rather than the Apache user, which helps troubleshoot various situations. Configuring DirectAdmin to use the mod_ruid2 module provides performance and security benefits compared to the suPHP and mod_php + mod_ruid2 setups:

1) Reduced disk I/O – mod_php is already loaded in Apache, so there is no need to load the php binary and libraries every time.

2) Individual domain settings can be modified using the php.ini file.

3) This setup can be used with PHP OpCache to further enhance performance.

 

To set up mod_ruid2, ensure that the server is running PHP as an Apache module. Configuring mod_ruid2 on a DirectAdmin server with custom-build 2 is straightforward.

1) First, verify that PHP is running as an Apache module. This means the mod_php module should be installed alongside Apache. By default, this setup has no security as processes run under the Apache user “nobody.” Enabling mod_ruid2 changes the ownership to the user. Log in to the server via the command line and execute the following command to check if PHP is running as mod_php:

# grep php1_mode=mod_php /usr/local/directadmin/custombuild/options.conf -c

If the output is “1,” PHP is running as mod_php. Proceed to the next step.

2) To install the mod_ruid2 module, execute the following commands one by one on the server. Ensure that each step completes without errors to avoid any serious issues:

# cd /usr/local/directadmin/custombuild/

# ./build update

# ./build set mod_ruid2 yes

# ./build mod_ruid2

# ./build rewrite_confs

If all steps complete successfully, it’s time to correct the ownership and permissions of existing files and folders on the server.

3) To fix ownership and permissions, execute the following commands as the root user on the server:

# cd /usr/local/directadmin/scripts && ./set_permissions.sh user_homes

# find /home/*/domains/*/public_html -type d -print0 | xargs -0 chmod 755

# find /home/*/domains/*/public_html -type f -print0 | xargs -0 chmod 644

# find /home/*/domains/*/public_html -type f -name ‘*.cgi*’ -exec chmod 755 {} ;

# find /home/*/domains/*/public_html -type f -name ‘*.pl*’ -exec chmod 755 {} ;

# find /home/*/domains/*/public_html -type f -name ‘*.pm*’ -exec chmod 755 {} ;

# cd /usr/local/directadmin/data/users && for i in $(ls); do chown -R $i:$i /home/$i/domains/*/public_html; done;

That’s it! You have successfully installed and configured mod_ruid2 within Apache for improved performance and security.

 

If you need any assistance with the above setup, feel free to contact our support team.

 

Post Your Comment