Multi-site support

CabloyJS supports the development of multi-site through the mechanism of multi-instance

See also: EggBornJS: Multi-instance

Instance Configuration

In Cabloy-CMS, the domain name is generally left to the static parts, so a sub domain name needs to be assigned to the dynamic parts, such as

Name Domain Description
Static Parts static files
Dynamic Parts backend API services


// instances
config.instances = [
  { subdomain: 'admin', password: '', title: '',
    config: {
      'a-base': {
        jsonp: { whiteList: '' },
Name Description
subdomain subdomain
password the initial password of the user root
title website’s title
  • config:modules’s configuration in the instance

The configuration of module a-base is modified here:

Name Description
jsonp.whiteList whitelist for cors. only domain names in the whitelist can access the backend API services through ajax

Because the domain of static parts is different from the domain of dynamic parts , json.whitelist must to be set

Build Frontend

$ npm run build:front

Start Backend Service

$ npm run start:backend
$ npm run start:backend -- --daemon --workers=2 
  • Do not forget to create a MySQL database and configure src/backend/config/

Stop Backend Service

$ npm run stop:backend

Startup Parameters of Backend Service


// backend
const backend = {
  port: 7002,
  hostname: '',

Nginx Configuration

It is highly recommended to use nginx to host frontend static resources and to apply reverse proxy to backend service

Two nginx configuration files have been generated in the project root directory, which correspond to the dynamic and static parts of Cabloy-CMS respectively. Please modify them according to actual needs

Dynamic Parts: nginx.conf

See also: Nginx Configuration

Static Parts: nginx-cms.conf

server {

  listen 80;

  root {publicDir}/{instanceId}/cms/dist;