Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2008
    Location
    127.0.0.1
    Posts
    451

    Arrow WHMCS : 2 Companies in 1 Installation

    How To Setup WHMCS - One Installation, Multiple Domains


    This is Really Cool :

    The company I work for pays for 6 WHMCS licenses. This means 6 different brands that we manage. Unfortunately, since WHMCS devs failed to read a basic PHP web security book, it needs to be updated almost every other week to keep up with the new security vulnerabilities.

    These 6 installations where all on separate servers. Maintaining each one and having to manually upgrade was ridiculous. So I used brain power and combined them into one installation.

    For this example, I will be using domain1.com and domain2.com. This setup can handle as many as you need. I am assuming you have root access to a basic Linux server.

    Step By Step :

    - Create a user on the server “whmcs”
    - - This user should be pointed to /home/whmcs

    # adduser -d /home/whmcs whmcs


    - Extract the WHMCS script into /home/whmcs/master
    - - This will be the single install of WHMCS and it’s root web directory - Create symbolic links
    - - This is used for DOCUMENT_ROOT reference

    # ln -s /home/whmcs/master domain1.com
    # ln -s /home/whmcs/master domain2.com


    - Edit /home/whmcs/master/configuration.php to the following
    - - We are creating logic to include a different configuration file depending on which domain is being visited.

    if ($_SERVER["DOCUMENT_ROOT"] == '/home/whmcs/domain1.com') {
    include('configuration_domain1.com.php');
    }
    if ($_SERVER["DOCUMENT_ROOT"] == '/home/whmcs/domain2.com') {
    include('configuration_domain2.com.php');
    }


    - Create and edit your new configuration files
    - - Edit the settings as necessary, but make sure to use domain1.com and domain2.com where specified

    /home/whmcs/configuration_domain1.com.php

    $license="";
    $db_host = "";
    $db_username = "";
    $db_password = "";
    $db_name = "whmcs_domain1";
    $cc_encryption_hash = "";
    $templates_compiledir = "/home/whmcs/domain1.com/templates_domain1_c";
    $api_access_key = "";
    session_name("WHMCS_DOMAIN1");
    $display_errors = true;

    /home/whmcs/configuration_domain2.com.php

    $license="";
    $db_host = "";
    $db_username = "";
    $db_password = "";
    $db_name = "whmcs_domain2";
    $cc_encryption_hash = "";
    $templates_compiledir = "/home/whmcs/domain2.com/templates_domain2_c";
    $api_access_key = "";
    session_name("WHMCS_DOMAIN2");
    $display_errors = true;


    - Create template caching dirs for the domains, then chmod 777
    - - Due to the WHMCS’s devs wisdom, they require the directory to be 777.

    # mkdir /home/whmcs/master/templates_domain1_c
    # mkdir /home/whmcs/master/templates_domain2_c
    # chmod 777 /home/whmcs/master/templates_domain1_c
    # chmod 777 /home/whmcs/master/templates_domain2_c


    Now your configuration and directory structure is completed. WHMCS is now ready for both domains to work from one installation.

    The easiest part of this is setting up the web server. You can use anything, Nginx, Apache, etc. All you do is setup the document root to the symbolic links you created.

    Your directory structure should look something like this.

    # ll /home/whmcs
    drwxr-xr-x 21 whmcs whmcs 4096 Jan 21 13:49 master
    lrwxrwxrwx 1 root root 7 Dec 11 11:41 domain1 -> master/
    lrwxrwxrwx 1 root root 7 Dec 11 11:41 domain2 -> master/


    Just to give you an idea, this is what an Nginx configuration could look like.

    server {
    listen 123.456.789.1:443;
    server_name domain1.com;
    root /home/whmcs/domain1.com;
    access_log /var/log/nginx/domain1.com-access.log;
    error_log /var/log/nginx/domain1.com-error.log;
    ...more stuff below...
    }
    server {
    listen 123.456.789.2:443;
    server_name domain2.com;
    root /home/whmcs/domain2.com;
    access_log /var/log/nginx/domain2.com-access.log;
    error_log /var/log/nginx/domain2.com-error.log;
    ...more stuff below...
    }


    Now when you visit domain1.com or domain2.com they will be accessing the same WHMCS installation. You can change the themes and templates as needed through the admin interface.

    For cron job setup, make sure to use WGET with the full domain name so that each configuration is populated correctly.
    Cron example:

    0 8 * * * /usr/bin/wget -O /dev/null https://domain1.com/admin/cron.php >/dev/null 2>&1
    0 9 * * * /usr/bin/wget -O /dev/null https://domain2.com/admin/cron.php >/dev/null 2>&1


    This setup works flawlessly. We’ve had zero problems and have gone through two WHMCS updates already.

    Enjoy!
    Credits : http://frustratedtech.com/post/74747...ltiple-domains
    XiNiX InfoTech Pvt. Ltd. ( Since 2005 ) : Quality Hosting @ Your Price !
    [ US/NL/IN ] Shared Hosting ♦ WHM Reseller ♦ VPS ♦ Dedicated Servers
    █ Included WHMCS ♦ SSL ♦ Domains ♦ IPMI ♦ SolusVM Visit Us Now

  2. #2
    Join Date
    Jan 2013
    Posts
    261
    Wow thanks for sharing this, looks interesting to try out as long as it isn't against WHMCS's rules.
    ⚫⚪⚫⚪ Running your web hosting business has never been easier - Hostistic.com
    ⚫⚪⚫⚪ More Details coming soon!

  3. #3
    Agreed, cool, but isn't this against WHMCS policies?
    Nividium
    Affordable, Reliable & High Performance Web Hosting Since 2011
    Google PageSpeed | Softaculous | SSD Drives | 24/7/365 Technical Support | Instant Activation

  4. #4
    Quote Originally Posted by babypurin View Post
    Agreed, cool, but isn't this against WHMCS policies?
    This doesn't look like it would be against policy because you still need to have a license for each domain.

  5. #5
    Good post It would have been better if WHMCS allowed managing multiple companies through single interface and single database.

  6. #6
    Join Date
    Apr 2009
    Location
    OnTheWeb
    Posts
    2,024
    Quote Originally Posted by VisionHelpdesk View Post
    Good post It would have been better if WHMCS allowed managing multiple companies through single interface and single database.
    You can if you use the "groups" option in WHMCS to separate clients from domain1 and domain2. When replying to tickets you can also use the {if} tags to determine which email and ticket branding is used based on the group / company the client belongs to.

    Even for the signup process, you can specify the template to be used in the URL and also with a little creativity, automatically add them to the group based on the URL specified
    If you're the smartest person in the room then you're in the wrong room

Similar Threads

  1. Replies: 0
    Last Post: 04-11-2011, 01:09 AM
  2. Replies: 0
    Last Post: 11-10-2010, 11:56 AM
  3. Replies: 2
    Last Post: 11-02-2010, 01:03 AM
  4. Replies: 0
    Last Post: 09-13-2010, 09:02 AM
  5. Replies: 0
    Last Post: 09-11-2010, 04:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •