Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Add internal IP address to existing Virtual Host?

Discussion in 'EasyApache' started by GGK, Jan 9, 2017.

  1. GGK

    GGK Registered

    Joined:
    Jan 9, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. GGK

    GGK Registered

    Joined:
    Jan 9, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page