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.

How to disable VirtualHost creation for a specific domain?

Discussion in 'EasyApache' started by pkiula, Aug 2, 2014.

  1. pkiula

    pkiula Member

    Joined:
    Jan 14, 2012
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi. For one of my domains, I need a heavily customized VirtualHost.

    Everytime the system updates or there's an EasyApache thing run, a new VirtualHost entry is created for me in the freshly revised httpd.conf file.

    Fortunately I have my VirtualHost customized in the post_virtualhost_2.conf file already. Including this file is the last line in the httpd.conf file.

    But it seems that if httpd.conf and then the virtualhost_2.conf both have the same VirtualHost directive for my domain (the httpd.conf being the default stuff that EasyApache writes, and the post_virtualhost_2.conf with all my heavy customization) then only the first one is taken into account by Apache!

    SO I have two options:

    1. Somehow tell EasyApache NOT to create a VirtualHost for one domain. It can create the VirtualHost stuff for other domains in my WHM because for them default settings are OK. Just the one domain which I want to be left out, and instead have the VirtualHost for that domain picked up from the post conf file.

    2. Or, I can somehow make Apache respect the *second* VirtualHost declaration of the same domain, which is included via the post_virtualhost_2.conf file.

    Any ideas on how to solve for this in a future-proof way? Thanks!
     
  2. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    You should probably try using the VirtualHost configuration section instead. This can be created under:

    Code:
    /usr/local/apache/conf/userdata/std/2_x/$USER/$domain.conf (x is either 2 or 4 (depending on your version of Apache)
    
    Documentation on this is Modify Virtualhost Containers With Include Files.
     
  3. pkiula

    pkiula Member

    Joined:
    Jan 14, 2012
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thank you. But in my server the '.../userdata/2.2" does not exist. Should I just create that folder, and put a file in there?
     
  4. Shavaun

    Shavaun Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    106
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    That is correct, you must create the directories.
     
  5. pkiula

    pkiula Member

    Joined:
    Jan 14, 2012
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    This is an include file. Which means the VirtualHost will be created for this domain in the httpd.conf, and my specified custom include file will be included in that VirtualHost.

    This is not what I want:

    What I want is that for the VirtualHost for one domain to be *entirely* created from a file. Not to have a VirtualHost created, and only an include file included at the end of it. How to do that?

    (The other option is to create a "Custom Template" for *all* virtualhosts, which is also *not* what I'm looking for. )
     
    #5 pkiula, Aug 4, 2014
    Last edited: Aug 4, 2014
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page