dennismv

Member
Sep 8, 2004
17
0
151
Problem: Cpanel keeps putting up a virtual host into my httpd.conf file. This causes a warning from apache, and also it disables my http access logging.

#VirtualHost directive I already have in my httpd.conf
<VirtualHost 44.44.44.45>
ServerName www.domain.com
.....
.... more options here ...
.....
</VirtualHost>

#VirtualHost directive Cpanel keeps adding (with the same IP address I've previously defined)?
<VirtualHost 44.44.44.45>
ServerName www.domain.com
</VirtualHost>

I have to go into httpd.conf every so often and delete this extra directive. I think it resets every day however, and messes up my log files.

Is there a way to stop this from happening ?
 

Spiral

BANNED
Jun 24, 2005
2,018
8
193
Simply set the attribute for the httpd.conf file with the below command

chattr +i /usr/local/apache/conf/httpd.conf

Nothing will be changed in the conf file unless attribute is removed. To remove the attribute use,

chattr -i /usr/local/apache/conf/httpd.conf
Shekhar, you are absolutely and completely out of your mind! :eek:

This is EXTREMELY BAD ADVICE!

While some files such as "/etc/antivirus.exim" and "/etc/resolv.conf" could benefit
from setting the immutable flag to prevent overwrites, you are asking for nightmare
problems if you set the immutable flag on the httpd.conf file!

Any subdomain added or removed by ANY USER needs to update the httpd.conf

Any add-on domain added or removed by ANY USER needs to update the httpd.conf

Any parked domain added or removed by ANY USER needs to update the httpd.conf

Changes to any of a great many settings in WHM will also effect the httpd.conf

Even general Cpanel updates may make changes to the system that make your
httpd.conf non-functional against the system software if the httpd.conf is immutable!