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.

sub domains wont work

Discussion in 'General Discussion' started by EMS, Sep 26, 2005.

  1. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    Scenario: Customer creates a subdomain.

    Problem: When navigating to the subdomain in a browser, the main domain is displayed, not the contents of maindomain/subdomain

    I can navigate to the maindomain/subdomain folder - this has been created fine.

    Whats wrong ?


    Here is the httpd.conf entry for the subdomain...

    <VirtualHost xx.xx.xx.xx>
    ServerAlias www.SUBDOMAIN.MAINDOMAIN.com
    ServerAdmin webmaster@SUBDOMAIN.MAINDOMAIN.com
    DocumentRoot /home/USERNAME/public_html/FOLDER
    BytesLog domlogs/SUBDOMAIN.MAINDOMAIN.com-bytes_log
    ServerName SUBDOMAIN.MAINDOMAIN.com

    <IfModule mod_userdir.c>
    Userdir disabled
    Userdir enabled USERNAME
    </IfModule>

    <IfModule mod_php4.c>
    php_admin_value open_basedir "/home/USERNAME:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule mod_php5.c>
    php_admin_value open_basedir "/home/USERNAME:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>

    User USERNAME
    Group USERNAME
    CustomLog /usr/local/apache/domlogs/SUBDOMAIN.MAINDOMAIN.com combined
    ScriptAlias /cgi-bin/ /home/USERNAME/public_html/FOLDER/cgi-bin/
    </VirtualHost>
     
    #1 EMS, Sep 26, 2005
    Last edited: Sep 26, 2005
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Try changing:

    Code:
    ServerAlias www.SUBDOMAIN.MAINDOMAIN.com
    to

    Code:
    ServerAlias SUBDOMAIN.MAINDOMAIN.com www.SUBDOMAIN.MAINDOMAIN.com
    Also, if you have wildcard subdomains set up and the ServerAlias section of the VirtualHost was not set correctly, it's possible that you might encounter the problem you describe.
     
  3. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    Thanks for your help.

    This still doesnt work.

    I've removed the subdomains and added a new one test.maindomain.com then checked the httpd.conf - it looks fine. Ive even taken your suggestion and changed the serveralias - same thing. Any subdomain that is added simply displays the main domain.

    This is driving me nuts.

    Can anyone hlep !!
     
    #3 EMS, Sep 26, 2005
    Last edited: Sep 28, 2005
  4. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    Hi, If anyone has experienced this problem before or could shed some light on it for me I'd be very grateful.

    I've done everything I can think of, including recompiling apache but any subdomains that get added just point to the main domain.


    Additional info...

    - Its just this one account with the problem.
    - httpd.conf entry for this subdomain is fine - same as another that works ok
    - this domain is on a fixed IP (could this be related somehow)
     
    #4 EMS, Oct 2, 2005
    Last edited: Oct 2, 2005
  5. mgsnnetworks

    mgsnnetworks Well-Known Member

    Joined:
    Sep 11, 2005
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Rhyl, North Wales, UK
    It sounds like a httpd problem try checking your httpd confıg for errors
     
  6. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    Looks fine, what should I be looking for ?
     
  7. elitewebninja

    elitewebninja Active Member

    Joined:
    Jan 2, 2004
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Atlanta Ga!
    Since the domain is on a fixed IP, YOU MUST have a NameVirtualHost entry for that IP address. Do you have a NameVirtualHost entry for that IP?

    Make sure you have one... should look like this:

    NameVirtualHost XXX.XXX.XXX.XXX:80

    Replace the XXX.XXX.XXX.XXX with the ip of course. This can be anywhere in the httpd.conf file, but I usually put it above the first entry for the domain so I can keep track of it.

    Here's an example of what it should look like:
    ***********************************************

    NameVirtualHost XXX.XXX.XXX.XXX:80

    <VirtualHost xx.xx.xx.xx>
    ServerAlias www.SUBDOMAIN.MAINDOMAIN.com
    ServerAdmin webmaster@SUBDOMAIN.MAINDOMAIN.com
    DocumentRoot /home/USERNAME/public_html/FOLDER
    BytesLog domlogs/SUBDOMAIN.MAINDOMAIN.com-bytes_log
    ServerName SUBDOMAIN.MAINDOMAIN.com

    <IfModule mod_userdir.c>
    Userdir disabled
    Userdir enabled USERNAME
    </IfModule>

    <IfModule mod_php4.c>
    php_admin_value open_basedir "/home/USERNAME:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule mod_php5.c>
    php_admin_value open_basedir "/home/USERNAME:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>

    User USERNAME
    Group USERNAME
    CustomLog /usr/local/apache/domlogs/SUBDOMAIN.MAINDOMAIN.com combined
    ScriptAlias /cgi-bin/ /home/USERNAME/public_html/FOLDER/cgi-bin/
    </VirtualHost>

    ***********************************************

    I bet this is your problem... let us know if this fixes it :)
     
    #7 elitewebninja, Oct 2, 2005
    Last edited: Oct 2, 2005
  8. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    You truly are an elite web ninja !

    NameVirtualHost was missing - added it in, works fine now !

    Thanks for your help !
     
  9. RizyDeWino

    RizyDeWino Well-Known Member

    Joined:
    Aug 1, 2005
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Planet Earth
    Thanks for the help !

    Now I am only wishing that I should have searched the forum before spending hours to solve this issue. I tried dozens of solution but nothing worked.

    NameVirtualHost was missing for only that spefic IP.
     
  10. chodan

    chodan Registered

    Joined:
    Nov 8, 2004
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    problem re-occurs

    How do we keep this problem from re-occurring. I dont want to have to mannually edit the httpd.conf every time our web dev adds a subdomain. Is there any preventative measures to take? or a fix?
     
Loading...

Share This Page