Categorized | Apache, cpanel

How to have Custom VirtualHost configurations without being overwritten with cpanel?

Cpanel virtualhost Function

Cpanel will always create apache configration and virtual host by its own template and every domian creation or susspenssion or termination or any thing else related to virtualhost configration of apache if being done will resultin cpanel to recreate apache virtualhost configration that will overwrite other custom modified settings.

Solution to have custom virtualhost configration

so that the cpanel will recreat virtualhost from its template how to have custom virtualhost of some domains configrations?

there is an answer to that question that is to have modified configration on elsewhere and then include it in to that virtual host but there maybe a question came to your mind that as the Cpanel will recreate the virtualhost from its template so that the include will also become overwritten.

Cpanel builtin scripts for including customized virtualhost configration

for this problem cpanle has created a ready made script that will verify your configration that should be inclueded that is

/scripts/ensure_vhost_includes

the step by step to how to do so is in the following

creating custom virtualhost configration step by step

1- create the commented include section directory such as this# Include “/usr/local/apache/conf/userdata/std/2/woshka/woshka.com/*.conf”

to create run

mkdir -p /usr/local/apache/conf/userdata/std/2/woshka/woshka.com/

2-go to that directory

cd /usr/local/apache/conf/userdata/std/2/woshka/woshka.com/

3-creat a config file than should be end by .conf

nano config.conf

4-put your custom config in that config file config.conf

5-run this

/scripts/ensure_vhost_includes --all-users

or with jsut that user

/scripts/ensure_vhost_includes username

you are now finished

for confirmation that everything is fine go to that virtualhost and verify that the included section is uncommented with that custom config name

hope you enjoyed this training

have fun

voshka

# Include “/usr/local/apache/conf/userdata/std/2/woshka/woshka.com/*.conf”

Related posts:

  1. how to optimize apache?
  2. How to have both fantastico running and shell_exec disabled on cpanel?
  3. how to rebuild httpd.conf in cpanel?
  4. creating backup of accounts in cpanel
  5. The way to prevent ddos attacks
  6. backup and restore Cpanel accounts with command line usnig ssh
  7. How to secure tmp the easy way if you have WHM/Cpanel

Leave a Reply

Plese subscribe to my newsletter

Please subscribe via your email to follow me

E-mail:

Subscribe
Unsubscribe