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.

Several / multiple virtualhosts for one cPanel user

Discussion in 'EasyApache' started by actived, Jul 2, 2015.

  1. actived

    actived Well-Known Member

    Joined:
    Mar 30, 2012
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hi,
    I have used cPanel/WHM very successfully for high-volume single-domain sites because I lack the expertise needed to secure a production linux box for a decent-sized business.

    Shared hosting obviously works well.

    But now I have a situation where I need one cPanel user to host 100-200 domains not as add-on domains in separate directories, but as Apache VirtualHosts from one cPanel user - the LAMP application handling all these domains is a single one and in the PHP code we check the domain and serve content accordingly.

    We are currently doing this with plain httpd.conf modifications using VirtualHosts with domains pointing to the same document root.

    Can this be done in cPanel without excessive/complicated hacking at Apache conf files?

    Currently this works:
    <Virtualhost ...>
    ...
    DocumentRoot /var/www/html/one_big_folder
    ...
    ServerName domain1.com
    Serveralias www.domain1.com
    </Virtualhost>

    <Virtualhost ...>
    ...
    DocumentRoot /var/www/html/one_big_folder
    ...
    ServerName domain2.com
    Serveralias www.domain2.com
    </Virtualhost>

    ...

    <Virtualhost ...>
    ...
    DocumentRoot /var/www/html/one_big_folder
    ...
    ServerName domain100.com
    Serveralias www.domain100.com
    </Virtualhost>


    Emails for all these domains are being handled separately are not a concern at all.

    If we can do this it means that we migrate to cPanel/WHM which is less headache and peace of mind for server administration .

    Thanks in advance.
    Regards,
    actived
     
  2. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    510
    Likes Received:
    66
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi,
    Why is there a need for individual virtual hosts? Why does addon domains not work? Unfortunately, in this situation, hard coding this would probably be the only solution, other than splitting the domains up between individual users.
     
  3. actived

    actived Well-Known Member

    Joined:
    Mar 30, 2012
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Firstly, thanks for the quick reply.
    Well:
    Now, if there is a solution in cPanel by which we can point all the add-on domain directories to a single directory, then I'm all ears.

    In which case, this would go to one of the pre/post template conf files, right?

    Regards,
    actived
     
    #3 actived, Jul 2, 2015
    Last edited: Jul 2, 2015
  4. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    510
    Likes Received:
    66
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Good morning,
    Thanks for the quick update. That makes sense, and it's not the first time I've heard of an application handling the domain routing. A wildcard domain might work well for you. That'll send *.domain.com to a specific directory, and the script / rewrite rules can do the rest.

    You an also point all addon domains to the same folder, this shouldn't be an issue. When you create the addon domain, point it to your specific folder instead of the default public_html/$domain folder.

    I hope this helps!
     
  5. actived

    actived Well-Known Member

    Joined:
    Mar 30, 2012
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hmm. This is a good tip. I will try this soon and post an update if it works.
    Thanks again for the fast reply.

    Regards,
    actived
     
Loading...

Share This Page