Editing VirtualHost templates to allow for NAT


Active Member
Jan 14, 2010
cPanel Access Level
DataCenter Provider
We've got a new cPanel installation which is running on a server in a 1-to-1 NAT environment. I understand cPanel doesn't properly support NAT, but at the same time I'm not in a position to change the existing network infrastructure in front of the server.

Since the DNS records automatically created are based on the IP address of the server I've obviously got the server configured to use its external IP, however, for the websites to be accessible they need to be running on the internal IP address.

Since the main purpose of the server is to provide web hosting only, I'm trying to work around this by editing the VirtualHosts template file to explicitely state the IP address to use, rather than detect it from the server. I've tried editing /var/cpanel/templates/apache2/vhost.local from :

<VirtualHost[% FOREACH ipblock IN vhost.ips %] [% ipblock.ip %]:[% ipblock.port %][% END %]>



however when I create a new account the new entry in httpd.conf still has still be completed with the external IP address.

Am I wrong to think this should work, am I perhaps editing the wrong template file, or is there a different way I should be doing this?

Thread starter Similar threads Forum Replies Date
R Operating Systems 5