Apache httpd.conf keeps reverting IP address...

jols

Well-Known Member
Mar 13, 2004
1,107
3
168
Hi,

I hope someone has a solution for this.

We've got a bit of an unusual situation in that the main "A" record for the account is directing traffic to an external server. However, they want to keep the traffic for a sub-domain (redirect) that is currently installed.

So while www.domain.com goes to an external server, for subdomain.domain.com they want to keep the traffic going to subdomain.domain.com/subdir (which is on the local server).

Okay, so I have everything else figured out and it works fine as long as the Apache httpd.conf VirutalHost entry does not change for the sub-domain. BUT, from time to time the httpd.conf reverts the VirutalHost entry for this sub-domain back to the external IP address and messes things up.

Now, I understand this comment in the httpd.conf file:

# DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

But how do I use an include file when I need to keep an IP address from changing in the VirutalHost tag?

Anyone?

Thanks much.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
Hi,

I hope someone has a solution for this.

We've got a bit of an unusual situation in that the main "A" record for the account is directing traffic to an external server. However, they want to keep the traffic for a sub-domain (redirect) that is currently installed.

So while www.domain.com goes to an external server, for subdomain.domain.com they want to keep the traffic going to subdomain.domain.com/subdir (which is on the local server).

Okay, so I have everything else figured out and it works fine as long as the Apache httpd.conf VirutalHost entry does not change for the sub-domain. BUT, from time to time the httpd.conf reverts the VirutalHost entry for this sub-domain back to the external IP address and messes things up.

Now, I understand this comment in the httpd.conf file:

# DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

But how do I use an include file when I need to keep an IP address from changing in the VirutalHost tag?

Anyone?

Thanks much.
Rather than using an Include, you would use a custom VirtualHost template. More specifically, a custom template that will only be used by the specific domain. You can find information on that here: InsideVHost < EasyApache3 < TWiki
 

Spiral

BANNED
Jun 24, 2005
2,018
8
193
Forget about doing anything customized in Apache for this based on what you said in your original post above .....

It's all utterly pointless for what you are doing! :rolleyes:

If all that you are hosting is the subdomain (and DNS presumably else you wouldn't be running into the issue you are describing) then I would create a brand new hosting account with the "subdomain" address as the primary domain name for the hosting account itself.

All you would need to do DNS wise is just add the base domain name as an extra DNS zone to the server (WHM -> Add a DNS zone) and add an "A" record to that zone for the subdomain and the external IP on the www.

Setup this way, you don't have anything setup in Apache at all for the root level domain while you do have the subdomain setup locally in it's own virtualhost in Apache.

Nothing around on the system to "overwrite" or mess up in the first place

--- that's a whole lot cleaner there that way.