Customize apache's default VirtualHost

prohostvn

Registered
May 7, 2012
1
0
51
cPanel Access Level
Root Administrator
I also can not change my default virtualhost

<VirtualHost 221.132.35.203:80>
ServerName vdc035203.prohost.vn
DocumentRoot /usr/local/apache/htdocs
ServerAdmin [email protected]
<IfModule mod_suphp.c>
suPHP_UserGroup nobody nobody
</IfModule>
UserDir disable
</VirtualHost>


I tried to add this directly to httpd.conf, ex:
I want to change "DocumentRoot /usr/local/apache/htdocs" ==> "DocumentRoot /home/default/public_html".
Then rebuild, and the change is lost.

Thanks!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Modifying /usr/local/apache/conf/httpd.conf directly for the VirtualHost sections will not be maintained at all. This is indicated above each one, including the default VHost for the server's hostname:

# DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.
If you wish to modify that default entry, you'd do so in /var/cpanel/userdata/nobody/host.domain.com where host.domain.com is the server's hostname. Here's what it looks like:

Code:
[email protected] [~]# cat /var/cpanel/userdata/nobody/host.domain.com
---
documentroot: /usr/local/apache/htdocs
group: nobody
hascgi: 1
ifmodulemodsuphpc:
  group: nobody
ip: "*"
phpopenbasedirprotect: 1
port: 80
serveradmin: [email protected]
serveralias: ''
servername: host.domain.com
usecanonicalname: 'Off'
user: nobody
userdirprotect: ''
If you revise the path in this file, please run the following commands afterward:

Code:
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak120508
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
Thanks!