How to configure multiple resellers on the same server

In order to have multiple resellers on the same server you need to copy the default Fleio frontend and change the nginx configuration. We will setup an additional reseller frontend for RESELLERX. with the following URL structure:

Cloud Admin: {{ your domain }}/staff
All reseller url: {{ your domain }}/reseller

RESELLERX:

Reseller login: {{ your domain }}/resellerX
Enduser-reseller1 login: {{ your domain }}/enduserresellerX
Enduser-reseller1 sign up: {{ your domain }}/enduserresellerX/signup

You can replace resellerx or enduserrresellerx with the desired pages.

Nginx configuration

You will need to add two new nginx vhosts for each reseller. One is the vhost for /resellerx and one for /enduserresellerX

server {

…
    location / {
        alias /var/webapps/fleio/frontend/site/;
        expires -1;
        try_files $uri $uri/ /index.html;
    }

# resellerX locations

    location /resellerX {
        alias /var/webapps/fleio/frontend/resellerX/reseller/;
        expires -1;
        try_files $uri $uri/ /../reseller/index.html;
    }

    location /enduserresellerX {
        alias /var/webapps/fleio/frontend/resellerX/site/;
        expires -1;
        try_files $uri $uri/ /index.html;
    }
}

After you edit the nginx configuration you can validate it by running:

nginx -t

If the configuration is valid you can restart nginx using service nginx restart.

Reseller / end user panel

First you will need to duplicate the existing panels. In order to do that, you need to run the following commands:

cd /var/webapps/fleio/frontend
mkdir /var/webapps/fleio/frontend/resellerX
cp -R /var/webapps/fleio/frontend/reseller /var/webapps/fleio/frontend/resellerX/
cp -R /var/webapps/fleio/frontend/site /var/webapps/fleio/frontend/resellerX/
rm -rf /var/webapps/fleio/frontend/resellerX/site/staff
chown -R fleio:fleio /var/webapps/fleio/frontend/resellerX

Now we need to apply some changes to the following files:

  • /var/webapps/fleio/frontend/resellerX/site/index.html

Change the base href from:

<base href="/"> to <base href="/enduserresellerX/">
  • /var/webapps/fleio/frontend/resellerX/reseller/index.html

Change the base href from:

<base href="/reseller/"> to   <base href="/resellerX/">

The last step is to set the reseller’s client ID in the reseller’s front end constants.js file. See Force newly registered users to be created under a reseller

Warning

After each Fleio update you need to re-do the reseller / end-user duplication. This may be changed in the future.