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.

VirtualHost include not working

Discussion in 'General Discussion' started by pabmeister, Sep 15, 2014.

  1. pabmeister

    pabmeister Registered

    Joined:
    Sep 15, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    In WHM, I am trying to set up a VirtualHost to pick up a domain (mapped to the server IP via A Record) and point it to an existing domain on the server.

    Code:
    <VirtualHost *:80>
        ServerName existingdomain.co.uk
        ServerAlias mappeddomain.com
    </VirtualHost>
    
    I put this in the "Post VirtualHost Include" and saved it, and restarted Apache.

    I even checked the file on the server, using the command line and it was written properly, and included in the httpd.conf file.

    However, going to "mappeddomain.com" simply shows the cPanel "defaultwebpage.cgi" page, saying "Sorry".

    Is there anything else I need to do? Any idea why this simply isn't working?
     
  2. pabmeister

    pabmeister Registered

    Joined:
    Sep 15, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have also tried (after removing the above edits) putting a new *.conf file into the userdata folder (which I had to create) putting in all the VHost info, and adding an extra alias.

    The file saved OK and I restarted Apache. Same cgi page is served up when I goto mappeddomain.com. I even tried putting in a file name afterwards (that I can access via exisitngdomain.com/file.txt) but it just gives me a 404 error.

    I am sure I have done this all correctly, but it just doesn't work :/
     
  3. Shavaun

    Shavaun Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    106
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    I may not be understanding you correctly, but it sounds like you are trying to create what we refer to as a "parked domain." You can find instructions on how to add a parked domain and set it to redirect to another domain here: http://documentation.cpanel.net/display/1144Docs/Parked+Domains

    At the bottom of that document you can also see a table that explains the difference between an addon domain versus a parked domain. If what you actually want is an addon domain, you can find directions about how to add one here: http://documentation.cpanel.net/display/1144Docs/Addon+Domains

    As far as modifying your httpd.conf file manually, we don't recommend it since most features are available via WHM. However if you must do so, our documentation about how to do it is here: http://documentation.cpanel.net/display/EA/Advanced+Apache+Configuration
     
  4. pabmeister

    pabmeister Registered

    Joined:
    Sep 15, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Just a quick update, before I read the documents you linked.

    I did actually manually edit the httpd.conf, adding "mappeddomain.com" as an entry in the ServerAlias for the existingdomain.com VHost entry, and it now works.

    Seems there are issues when trying to use includes (both the includes in WHM and includes via the userdata .conf file)

    - - - Updated - - -

    OK< I read the Parked Domain docs, and I did actually try this in cPanel, but in my current tests, "mappedomain.com" is mapped to the server via an A Record.

    The cPanel "Parked Domains" tool states that the domain you are trying to "park" must be pointed to the Nameservers, something I do not want to do in this current test. The A Record should be enough (and in fact, it is, as I got this to work by manually editing the main httpd.conf file - something I don't want to do, but it was the only way this work would)
     
  5. Shavaun

    Shavaun Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    106
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    I'm not aware of any issues with the include files, but it sounds like you got it working. Were there incorrect instructions in the documentation or was anything unclear?

    Regarding the built-in functionality in WHM for Parked Domains, you can enable the "Allow Remote Domains" option in the Domains tab of the Tweak Settings interface. We disable this by default to prevent security and fraud problems, but it will allow you to add a Parked domain without it pointing to the nameservers, after which you can disable the option again.
     
Loading...

Share This Page