If you want to some custom entry added for a vhost for single domain then you can easily do it by creating /usr/local/apache/conf/userdata/std/2/username/*.conf and adding the entries to it. But what if you want to add those entires to every domain on the server and the server contains more than 1000 domains. You can add it manually, create a custom script which will create all those files automatically. But what happens when you add a new domain to server? Then you will have to do the same for new domain again. The simple and best solution for this is to modify the cpanel apache vhost template itself so that you never have to worry again.

First of all copy vhost.default to vhost.local

cp -a /var/cpanel/templates/apache2/vhost.default /var/cpanel/templates/apache2/vhost.local

Now edit the vhost.local and add you custom entries

<IfModule mod_custom> Setting1 Value1 Setting2 Value3 Setting3 Value3 ... </IfModule>

Now rebuild the apache conf and restart apache and you are done 🙂

/scripts/rebuildhttpdconf /etc/init.d/httpd restart

If you want a professional server management company to look into your cPanel Server then you can take a look at our cPanel Server Management plan.