Disable mod_userdir for LSWS on cPanel

On cpanel, there is an Apache mod_userdir tweak, which you can use to disable/enable mod_userdir for Apache. When you are running Apache, mod_userdir is not compatible with the following modules/handlers and is actually disabled when mod_passenger, mod_ruid, mod_itk, PHP-FPM, or the CGI handler used.

Sometimes, when you disable mod_userdir on Apache, it seems to still be working with LSWS. So how do you correctly disable mod_userdir for LSWS on cpanel then?

vi /etc/apache2/conf/httpd.conf

In server level configuration:

<IfModule userdir_module>
  UserDir public_html
  <IfModule ruid2_module>
    UserDir disabled
  </IfModule>
  <IfModule mpm_itk.c>
    UserDir disabled
  </IfModule>
  <IfModule mod_passenger.c>
    UserDir disabled
  </IfModule>
</IfModule>

In vhost level configuration:

<IfModule userdir_module>
 <IfModule !mpm_itk.c>
  <IfModule !ruid2_module>
  <IfModule !mod_passenger.c>
    UserDir disabled
    UserDir enabled check10cache
  </IfModule>
 </IfModule>
 </IfModule>
</IfModule>

Apache may use itk, ruid2 and/or mod_passenger. In any of these cases, mod_userdir is disabled on Apache. LSWS does not use config for ruid2, itk and mod_passenger, hence only the following directive is applied, which actually enables mod_userdir.

UserDir public_html

To fix this, you can add “UserDir disabled” to pre_virtualhost_global.conf

vi /etc/apache2/conf.d/includes/pre_virtualhost_global.conf

<IfModule LiteSpeed>
UserDir disabled
</IfModule>

and then add “userdir” to the list of Apache modules to ignore in LSWS configuration:Navigate to LSWS Web Admin: Configuration > Server > General > Using Apache Configuration File > Ignore Apache Modules and add userdir.

Restart LSWS after the configuration change.

service lsws restart
 
litespeed_wiki/cpanel/disable-mod-userdir-lsws-cpanel.txt · Last modified: 2018/08/09 19:40 by Jackson Zhang