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.

mod_vhost_alias and cPanel - Folders as subdomains

Discussion in 'EasyApache' started by N1ghteyes, May 25, 2015.

  1. N1ghteyes

    N1ghteyes Active Member

    Joined:
    Mar 3, 2014
    Messages:
    33
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Reading, UK
    cPanel Access Level:
    Root Administrator
    Twitter:
    EDIT:-- Before anyone points it out, yes i know i can go to cpanel > subdomains, no in this case that is not an option.

    I need to config a cpanel account to use mod_vhost_alias to convert folders under /public_html to subdomains.

    I.e. if i create the folder /public_html/test i need test.domain.co.uk to just work.

    I have the setup working under Elementary OS (its basically Ubuntu 14.04 LTS), i need it to work on a cpanel server though.

    So far i have:
    - Rebuilt easy apache to include mode_vhost_alias
    - for the account i have setup a wildcard DNS entry (A record)
    - in the accounts custom config (/var/cpanel/userdata/scweb/domain.co.uk) i have changed the doumentroot to /home/scweb/public_html/%1/ as per the mod_vhost_alias docs.
    - in the accounts custom config i have also changed the serveralias to *.scwebdesign.co.uk

    i have restarted the httpd service

    under public_html i have created a directory called test and inside that an index.html file.

    Still, i cant get this to work. Does anyone have any ideas? (full account config):

    Code:
    ---
    customlog:
      -
        format: combined
        target: /usr/local/apache/domlogs/domain.co.uk
      -
        format: "\"%{%s}t %I .\\n%{%s}t %O .\""
        target: /usr/local/apache/domlogs/domain.co.uk-bytes_log
    documentroot: /home/scweb/public_html/%1/
    group: scweb
    hascgi: 1
    homedir: /home/scweb
    ifmoduleconcurrentphpc: {}
    
    ifmoduleitkc: {}
    
    ifmodulemodincludec:
      directoryhomescwebpublichtml:
        ssilegacyexprparser:
          -
            value: " On"
    ifmodulemodsuphpc:
      group: scweb
    ip: 130.185.146.188
    owner: root
    phpopenbasedirprotect: 1
    port: 80
    scriptalias:
      -
        path: /home/scweb/public_html/cgi-bin
        url: /cgi-bin/
      -
        path: /home/scweb/public_html/cgi-bin/
        url: /cgi-bin/
    serveradmin: [EMAIL]webmaster@domain.co.uk[/EMAIL]
    serveralias: "*.domain.co.uk"
    servername: domain.co.uk
    usecanonicalname: 'Off'
    user: scweb
    userdirprotect: ''
     
    #1 N1ghteyes, May 25, 2015
    Last edited by a moderator: May 25, 2015
  2. LostNerd

    LostNerd Well-Known Member

    Joined:
    Mar 12, 2014
    Messages:
    258
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Hastings, East Sussex, UK
    cPanel Access Level:
    Root Administrator
    Twitter:
    You will still require an A entry for each subdomain. Have you considered this?
     
  3. N1ghteyes

    N1ghteyes Active Member

    Joined:
    Mar 3, 2014
    Messages:
    33
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Reading, UK
    cPanel Access Level:
    Root Administrator
    Twitter:
    There is a wildcard dns A record entry for *.scwebdesign.co.uk, should cover any need for subdomain records, confirmed as working for www. (It resolves to root as expected)
     
  4. LostNerd

    LostNerd Well-Known Member

    Joined:
    Mar 12, 2014
    Messages:
    258
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Hastings, East Sussex, UK
    cPanel Access Level:
    Root Administrator
    Twitter:
    My apologies! I'm not much more help than that.
     
  5. N1ghteyes

    N1ghteyes Active Member

    Joined:
    Mar 3, 2014
    Messages:
    33
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Reading, UK
    cPanel Access Level:
    Root Administrator
    Twitter:
    hehe no worries. Im 90% sure i've missed something simple, just not sure what :/
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You may want to consider simply developing a script that utilizes our API to create a subdomain or addon domain anytime a directory is created (or when a script detects the creation of a directory). The customization you are using is not supported, so you may need to consult with a qualified system administrator for help with getting it implemented properly.

    Thank you.
     
Loading...

Share This Page