SOLVED Problem with vhosts include file

Troncaa

Registered
Jan 15, 2018
4
0
1
Montreal
cPanel Access Level
Root Administrator
I have change /etc/apache2/conf.d/includes/pre_main_global.conf to add this block:

<IfModule LiteSpeed>
LiteMage Off
</IfModule>

Which works good, with this, I disabled LiteMage for all users.

Now I want to enable it for a specific account, account name is blipblop,

so I create 2 files:
/etc/apache2/conf.d/userdata/std/2_4/blipblop/litemage.conf
and
/etc/apache2/conf.d/userdata/ssl/2_4/blipblop/litemage.conf

both with this content:

<IfModule LiteSpeed>
LiteMage On
</IfModule>

But it's like the file is not read or not process, LiteMage will still be disabled for this account, I have reload and restart the service but still wont process this code...

Why is my account .conf file not working?

Thank you
 

cPWilliamL

cP Technical Analyst II
Staff member
May 15, 2017
258
30
103
America
cPanel Access Level
Root Administrator
Hi,

Could you verify that the userdata include is enabled? You can open of up '/etc/apache2/conf/httpd.conf' and verify the `Include "/etc/apache2/conf.d/userdata/' statement is not commented out for the desired vhost; the command below should also show which userdata includes are uncommented for each vhost:
Code:
# awk '/^<VirtualHost /{f=1;getline;servername=$2}/^(\s+)Include \"\/etc\/apache2\/conf.d\/userdata/{if (f=1) print servername,$0}/<\/VirtualHost>/{f=0}' /etc/apache2/conf/httpd.conf
cptest.tld   Include "/etc/apache2/conf.d/userdata/std/2_4/cptest/*.conf"
cptest.tld   Include "/etc/apache2/conf.d/userdata/std/2_4/cptest/cptest.tld/*.conf"
Thanks,
 

Troncaa

Registered
Jan 15, 2018
4
0
1
Montreal
cPanel Access Level
Root Administrator
Hi,

The only include in each vhost is Include "/etc/apache2/conf.d/userdata/*.conf", I dont see any include commented out, running your command also confirm that this is the only include in the vhost.

Is this is something missing in my cpanel configuration? shouldn't I have by default the include in vhost file for
Include "/etc/apache2/conf.d/userdata/std/2_4/cptest/*.conf" and
Include "/etc/apache2/conf.d/userdata/std/2_4/cptest/cptest.tld/*.conf"?

Thanks
 

cPWilliamL

cP Technical Analyst II
Staff member
May 15, 2017
258
30
103
America
cPanel Access Level
Root Administrator
The includes are uncommented dynamically on rebuild of the Apache configuration should the file be present. I just wanted to be sure that includes were properly enabled in the Apache configuration. If you received output from that command for the specified domain, then that should mean it's been properly enabled in Apache configuration.

This should work for you. How are you testing? Is the domain behind any CDN or proxy? Are you using any custom Apache templates?
 

Troncaa

Registered
Jan 15, 2018
4
0
1
Montreal
cPanel Access Level
Root Administrator
Hi,

I have no CDN or proxy, I'm using litespeed server to serve http, but litespeed use the apache config files so it shouldn't matter.

As I said only include I have in my vhost is for /etc/apache2/conf.d/userdata/*.conf, do I need to run the rebuild in order to add the new file I added under /etc/apache2/conf.d/userdata/std/2_4/blipblop/litemage.conf? Can I rebuild from WHM or do I need to use the command Line?
 

cPWilliamL

cP Technical Analyst II
Staff member
May 15, 2017
258
30
103
America
cPanel Access Level
Root Administrator
Any time you create or remove a userdata file, you must rebuild the Apache configuration. I thought from your previous comment that you were implying that the include was present.

Please re-read the documentation to gain a better understanding of the includes file path structure:
Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation

When you run that awk command, take the include file that was returned, and 'ls' or 'cat' the include:
Code:
# awk '/^<VirtualHost /{f=1;getline;servername=$2}/^(\s+)Include \"\/etc\/apache2\/conf.d\/userdata/{if (f=1) print servername,$0}/<\/VirtualHost>/{f=0}' /etc/apache2/conf/httpd.conf
cptest.tld   Include "/etc/apache2/conf.d/userdata/std/2_4/cptest/cptest.tld/*.conf"

# ls /etc/apache2/conf.d/userdata/std/2_4/cptest/cptest.tld/*.conf
/etc/apache2/conf.d/userdata/std/2_4/cptest/cptest.tld/testing.conf
If you receive 'No such file or directory', there is an issue; otherwise, if you see your configuration, there is no issue with updating the Apache configuration with the include file.

How are you testing this?