Add internal IP address to existing Virtual Host?

GGK

Registered
Jan 9, 2017
2
0
1
Santa Clara,ca
cPanel Access Level
Root Administrator
I have a Linux CentOS 7.2 server with Apache 2.4 whose httpd.conf is created/maintained by WHM 60.0 build 31.

The httpd.conf file has a Virtual Host section for one of my websites that looks like:

<VirtualHost xxx.xxx.xxx.xxx:80>
...
</VirtualHost>

Everything runs fine.

Now, I need to allow an internal IP access to this Virtual Host. I know this can easily be done as described here,

VirtualHost Examples - Apache HTTP Server Version 2.4

in the third section (titled, "Serving the same content on different IP addresses (such as an internal and external address).") by modifying the httpd.conf file to look like:

<VirtualHost 192.168.0.1:80 xxx.xxx.xxx.xxx:80>
...
</VirtualHost>

However, I suspect WHM will overwrite this upon restarting the Apache web server, etc.

How can I accomplish extending a Virtual Host to an internal IP address within the confines of WHM controlling httpd.conf?
 

GGK

Registered
Jan 9, 2017
2
0
1
Santa Clara,ca
cPanel Access Level
Root Administrator
Yes, I currently use include files for my existing virtual hosts. However, I don't believe this answers my question.

For example, how could I modify this existing VirtualHost

<VirtualHost xxx.xxx.xxx.xxx:80>
...
</VirtualHost>

to become

<VirtualHost 192.168.0.1:80 xxx.xxx.xxx.xxx:80>
...
</VirtualHost>

using an include file?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Hello,

While it's supported by Apache 2.4, I don't believe cPanel/WHM will recognize multiple IP addresses assigned to a single Virtual Host. I recommend opening a feature request if it's an option you want to see configurable in WHM:

Submit A Feature Request

If it's an internal IP address, you should consider using the NAT feature:

1:1 NAT - Documentation - cPanel Documentation

Thank you.