24
custom virtualhost settings in cPanel
Filed Under (cPanel/WHM, Linux) by WebScHoLaR on 24-02-2011
Tagged Under : cpanel, virtualhost
cPanel allows custom modification to any website Virtual Host section. httpd.conf in cPanel server is no longer used as a data store and it is rebuilt based on information stored at /var/cpanel/userdata mostly. A directory is created for each user at /var/cpanel/userdata that contains information about the websites. Virtual host section is added for each website that is setup in cPanel. Any custom settings can be added to Virtual Host using include file that should be created at following path:
“/usr/local/apache/conf/userdata/std/2/USERNAME/DOMAIN.COM/*.conf”
Lets suppose we have a requirement of adding AllowOverride parameter for the website. AllowOverride is not allowed in .htaccess so it need to be added to httpd.conf. As httpd.conf will be rebuilt every time a new site is created so this section cannot be added directly to httpd.conf as it will not be preserved. In order to add it permanently, it can be added inside:
“/usr/local/apache/conf/userdata/std/2/cpuser/cpdomain.com/include.conf”
with the contents:
<Directory /home/cpuser/public_html>
AllowOverride All
</Directory>
then httpd.conf needs to be rebuilt as:
/scripts/rebuildhttpdconf
and Apache restart finally:
/scripts/restartsrv httpd
