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.

Virtual Host setup for Sub Domain

Discussion in 'General Discussion' started by zorba, Mar 5, 2012.

  1. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I've just created my first VPS which is unmanaged so I cannot get cPanel help via my hosting provider (as opposed to fixes for problems with the hosting service).

    I have full root access to WHM, and I've created a new user and associated it with a new domain which has been propagated. Trouble is that the domain routes just to the default cPanel page "cgi-sys/defaultwebpage.cgi" and it does not find any web pages within the user account's public_html folder. I can see pages via the main VPS domain using the workaround of going to maindomain.org.uk/~mynewuser/ but I want to be able to use the new domain URL directly.

    I've discovered that I need to amend the entry for the virtual host - and I tried to do this by editing the DNS settings to change a local IP address (192.168...) to the server main IP address but now realise this was wrong. I believe that instead of this, I need to amend the virtual host entry for this new domain to point to the new user. However, if I just edit the httpd.conf file then I know that cPanel will just overwrite it when it next rebuilds Apache.

    Where should this virtual host entry for the new user be set up and why does cPanel not do this automatically for new users/sub domains please?

    All advice & help gratefully received...
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You should not have to actually modify anything. If the domain name's nameservers are set at the domain name registrar properly, and the account was created properly, things should work as expected, no custom editing of anything required.
     
  3. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Infopro - thanks - that answers my second question (why doesn't Cpanel do it - answer it should).
    Does this imply a bug in my version of cPanel or installation of cPanel or does something need tweaking via WHM?

    But I'm still left in a situation where the routing to the new domain does not work. I've checked my DNS entries via intoDNS and the entries show no errors.

    On checking I find that the entry in the httpd.conf file relating to the virtual host both make reference to an internal IP address <VirtualHost 192.168.128.149:80> so presumably this needs changing. And the comments in the file tell to make changes via the template files so is this vhost.default that needs fixing (in /var/cpanel/templates/apache) or do I need to create vhost.local?

    Thanks...
     
  4. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Infopro,

    Another thought - perhaps my routing problem has nothing to do with Virtual Hosts entries in the first place?

    Regards,
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Are you running cPanel on a home server of some sort?
     
  6. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Infopro,

    Sorry my notifications are not working so I'm not getting alerted to your responses.

    No, I'm running both WMH and cPanel on a VPS at UK2.Net with full rooot access - OS is pre-built CentOS with cPanel.

    Regards,
     
  7. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Email notifications on these forums should be working as expected provided you are subscribed to this thread or forum. If your email address is not valid, emails from the forum bounce back to us and we know about it, when it happens. I can find no bounced emails from your account so, you might want to check to make sure it was not sent to your spam folder by mistake for example.

    This part of your first post is confusing:

    The server must have a FQDN for it to work. Your accounts must use the proper nameservers as setup by you, to work as well.

    Have you setup your nameservers and the IPs they will use here:

    WHM > Server Configuration > Basic cPanel & WHM Setup, Config tab
     
  8. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Infopro,

    Thanks once again, I'm pleased to say that notifications are now working - I was just having my lunch this time!

    Note that routing into my main domain name for the VPS server as a whole works just fine.

    What does not work is any routing to other users on the VPS, one of which has their own domain name in the real world.

    I've checked the settings in WHM > Server Configuration > Basic cPanel & WHM Setup, Config tab and found that this points "* The IP address (only one address) that will be used for setting up shared IP virtual hosts." to 192.168.128.149. Is this where I should make the change to point it my external IP address if I'm using external name servers?

    I had previously found ths same entry in the DNS settings Main >> DNS Functions >> Edit DNS Zone so changed it to my external IP adress but this didn't help.

    I'm using external name servers owned by my hosting service, but thought I might need to use BIND internally as well but whether BIND is running or not makes no difference.

    Regards,
     
  9. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    This is an IP address for a computer behind a router. You would never use (that I'm aware of) this type IP anywhere in cPanel.
    Your home computers use IPs like this, not cPanel.

    At the top of that Config tab page, you should have the Main IP address given by your Hosting Provider.

    At the bottom of that same page, you decide what you'd like to use for your nameservers, for example:
    ns1.yourmaindomain.com
    ns2.yourmaindomain.com.

    You add those one by one, after each you'll click Assign IP address, and then go back and click Add an A entry for this Nameserver.

    If all goes well, the next step is adding those nameservers to your domain at your Domain Name Registrar.

    If all goes well, the next step is adding the account via WHM.
     
  10. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Infopro,

    Thanks - I realise that the 192. type address is only used internally but thought that perhaps it was used within the VPS or the hosts network, I guess I missed have missed setting it when first configuring WHM itself.

    I've amended this internal address in Basic config to the external IP of the main VPS.

    Also set up the name servers as advised (but suspect they were probably OK already).

    On saving got this message:

    "Modifying “Main Shared Virtual Host IP” from “192.168.128.149” to “109.123.110.104”.
    and "This system has no free IPs." - which is accurate - I only have one external IP asdress associated.

    However, on checking my httpd.conf I still see the virtual host entries still pointing to 192.168.128.149.

    Yesterday I had rebuilt Apache (via WHM) to include mysqli as well as mysql interface, would I now have to
    rebuild again to pull in these latest changes or should they get picked up after saving as I have done already?

    Regards,
     
  11. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You might try editing the zone for the domain here:
    WHM > DNS Functions > Edit DNS Zone

    When you save the system should update and spit out this message to you:
    "Bind reloading on hostname using rndc zone:"

    This area:
    WHM > DNS Functions > Nameserver IPs

    Is for informational purposes but should display the proper nameservers and IPs and show you how many zones are on each.
     
  12. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Infopro,

    Ok - did that and got the "Bind reloading on hostname using rndc zone:"

    WHM > DNS Functions > Nameserver IPs shows my 2 external Nameservers each with 4 Zones.

    But problem persists...any more ideas?

    Regards,
     
  13. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Are the proper IPs showing on the List Account page?
     
  14. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Infopro,

    Wow - what a great suggestion - that produced the giveaway response (showing cPanel earing its money!):

    Changing ip for mainsite.u3asitea.org.uk (mainsite) to 109.123.110.104

    Setting up for ip change..... Done

    The remote dns zone is not consistant with the httpd.conf.
    The current ip in httpd.conf is: 192.168.128.149.
    The current ip in the dns zone is: 109.123.110.104!

    109.123.110.104 will be switched to the new ip as well!

    The local dns zone is not consistent with the httpd.conf.
    The current ip in httpd.conf is: 192.168.128.149.
    The current ip in the dns zone is: 109.123.110.104!

    109.123.110.104 will be switched to the new ip as well!

    Warning, serious database inconsistency. httpd.conf, local dns, and remote dns all
    have different ideas about what the ip address of this site really is. They will now all be changed
    to the new ip: 109.123.110.104!

    Changed all instances of [109.123.110.104,192.168.128.149] -> [109.123.110.104] in mainsite.u3asitea.org.uk
    Updating httpd.conf....Done
    System has 0 free ips.
    Account modified. New ip is: 109.123.110.104.


    ...and lo and behold the sub-domain now works fine just as nature intended!

    I cannot thank you enough for your dogged persistence and help throughout the day that has eventually helped me to solve this problem - 300 odd charity websites that we run out of our database application owe you a great debt.

    I'm so glad that I joined this great community today!

    Kind Regards,

    Zorba
     
  15. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I enjoy helping most, at times like this. :p


    Thanks for letting us know that you got this sorted. Good luck!
     
  16. zorba

    zorba Member

    Joined:
    Mar 5, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Infopro,

    It's the first time I've ever posted into a technical forum - normally I find it sufficient to read the answers to someone else who has had a similar problem - but spending all yesterday afternoon with this approach didn't help.

    I cannot find a way to award you "thanks" or "stars" like some forums do, so I'll just say thanks once again!

    Kind Regards,
     
  17. genzwebsol

    genzwebsol Registered

    Joined:
    Mar 7, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    It is very help full for me and I am really very thanks to you all.
     
Loading...

Share This Page