ផ្នែកខ្លះនៃទំព័រនេះមិនត្រូវបានបកប្រែ សុំទោសចំពោះភាពរអាក់រអួល

Builder installation / update

Table of contents

Server

  • Apache 2.2 (or newer) (modules: rewrite (rewriting from .htaccess must be enabled), headers)
  • PHP 5.3.6 (or newer) (extensions: gd (version 2+), exif, mysql, sqlite, pdo, pdo_mysql, pdo_sqlite, json, curl, mbstring, iconv, xml, openssl, zlib, zip)
    Note: Published websites require PHP 5.3.6 (or newer) and Apache 2.2 (or newer) too.
  • MySQL 5.5 (or newer)
  • ionCube Loader (newest version possible) ionCube install instructions can be found at ionCube site: http://www.ioncube.com/loaders.php
    The recommended way of installing ionCube loader is by downloading loader wizard loader-wizard.zip, extracting it to web-servers document root and opening it via browser and then just following install instructions from there.
  • Web accessibility through domain (sub-domain). Local builder installations are not supported. Make sure that you specified correct domain (sub-domain) for builder. It must be accessible publicly on the WEB.
Important:
Make sure PHP xdebug extension is not installed.
For CentOS owners:
  • You will possibly need to enable curl, sockets, ... (network access) for web server. This can be done by executing command: setsebool -P httpd_can_network_connect on
  • If ionCube is not working there might be problems with SELinux permissions. To fix that execute command: ls -alZ /usr/lib64/php/modules/ to list all php modules (command part /usr/lib64/php/modules/ is a path where you installed ionCube loader, so you need to set it to where you installed it), and check if ionCube loader SELinux context matches other php modules, if not, set it to match using this command:
    chcon system_u:object_r:lib_t:s0 /usr/lib64/php/modules/ioncube_loader_lin_5.3.so (command part system_u:object_r:lib_t:s0 is the context string, so you need to change it to match other php modules).

Nginx if used instead of Apache

Configuration for builder:

If you want to use NGINX Web Server instead of Apache for builder installation you will need to configure separate virtual host (server configuration) for it. Ex. if your builder domain is some.builder.domain and builder is installed at /home/builder/public_html you could set server configuration to something like this:

... # click to expand
Note:
If you change "builderSitePathPrefix" configuration option then you need to replace it ("sitepro" string) here too. Also this is only one of possible configurations, your server might require it to be different (for ex. line fastcgi_pass 127.0.0.1:9000; might be different on your server) so you will need to adjust it.

Configuration for published websites:

If you want to use NGINX Web Server instead of Apache for published websites you need to configure separate virtual host (server configuration) for every website you will publish to. Ex. if web-sites you want to publish to domain is some.site.domain and it's document root is at /home/site/public_html you could set server configuration to something like this:

... # click to expand
Note:
If you change "builderSitePathPrefix" configuration option then you need to replace it ("sitepro" string) here too. Also this is only one of possible configurations, your server might require it to be different (for ex. line fastcgi_pass 127.0.0.1:9000; might be different on your server) so you will need to adjust it.
Show configuration example for Plesk

Plesk configuration example:

  • create file on Plesk server /usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php
  • copy contents of default file /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php to file you created
  • add the following content somewhere to the middle of the file (but be careful not to add it within some existing IF rule):
    <?php if (is_dir($VAR->domain->physicalHosting->httpDir.'/sitepro')): ?>
    location ~ /(\.ht|error_log|php_errors\.log)|^/sitepro/(vendor/|src/) {
            deny  all;
    }
    location ~ ^/ {
            index index.php index.html;
            try_files /sitepro$uri /sitepro$uri/ /sitepro/index.php?$args;
    }
    <?php endif; ?>

This template will add Site.pro required rules to all clients' sites nginx configuration if the site was published with Site.pro builder.
You can read more about Plesk template files here:
https://docs.plesk.com/en-US/onyx/advanced-administration-guide-linux/virtual-hosts-configuration/changing-virtual-hosts-settings-using-configuration-templates.68693/.

Installation

  1. Download site builder archive and extract it to your virtual host www folder:
  2. Open link in your browser (ex.: http://your-builder-domain.com/installer/) and follow instructions from there.
    Installation script can also be executed using CLI for automated installs (without requiring user interaction):
    php installer/index.php "/installer?host=[builder-hostname]&dbHost=[database-host]&dbName=[database-name]&dbUser=[database-user]&dbPass=[database-password]&cfgApiUser=[API Username from brand]&cfgApiPass=[API Password from brand]&cfgBrandId=[Brand ID]"
    Note:
    When running CLI installer will verify PHP CLI configuration and not the actual PHP configuration that will be used for running builder. Make sure they match.
  3. When installation completes, delete folder installer.
  4. Setup builder CRON. This will help you to optimize builder used space and keep builder up-to-date.

Video guide

Update

  1. Login to builder server console per SSH.
  2. Run the following command:
    cd [BUILDER_DIR] && php index.php /api/update-builder
    Note:
    If you have multiple PHP versions on server and PHP CLI version differs from PHP WEB version used by builder then specify correct PHP executable in CRON command. For example:
    cd [BUILDER_DIR] && /usr/bin/php7 index.php /api/update-builder
  3. Update file permissions:
    chown -R [USER]:[GROUP] ./* .htaccess
    Note: [USER] and [GROUP] must be replaced with appropriate values (user and group that server uses to run builder).
Note:
If due to some reason update fails you can try to update builder manually. After manual update is complete update process described in this part should start working.

HTTPS

In order to run builder under HTTPS protocol you need to take the following steps:

  • Update builder domain in your brand from "your-builder-domain.com" to "https://your-builder-domain.com".
  • Open file "config.json" located in your builder web-root directory and update parameter "siteProApiUrl" to be also with "https://".

Extra configuration

You can set extra options for your builder by modifying file "config.json" located in your builder web-root folder:

  • String — Plans separated by comma for which builder will not work default: -
  • String — Opposite to "disabledHostingPlans". If specified "disabledHostingPlans" will be ignored default: -
  • String — Message to show when hosting plan matches the one from specified in "disabledHostingPlans" option or when hosting plan is not included in plans specified in "enabledHostingPlans" option (used together with "disabledHostingPlans" or "enabledHostingPlans" accordingly). The value is multilingual.* default: default sentence(1)
  • String — Yandex Metrika ID for builder default: -
  • Boolean — Use Yandex Metrika ID only in public demo builder default: false
  • Object — Object adding extra buttons to builder toolbar - default: example below(2)
  • Boolean — Defines whether to use FTP with SSL encryption during publishing. default: false
  • String — Builder UI theme ID to use (currently only "modern" is available). Will be ignored if "themeUrl" is set. default: -
  • String — URL to css file to change builder UI style. default: -
  • String — Google.com Maps API key. Required to enable Google Maps plugin (get it from here). default: -
  • String — Google.com Fonts API key. Required to enable Google Fonts feature (get it from here). Note: Google Fonts also works with parameter "googleMapsApiKey" if set. default: -
  • Boolean — If true template usage statistics will be logged to database (enable only if you are using automated builder updates). default: false
  • Boolean — If true will show forced HTTPS port option in builder settings dialog. default: false
  • Boolean — If true will disable URL rewriting for published websites. default: false
  • Boolean — If true then forced HTTPS option will be enabled in new websites by default. default: false
  • Boolean — If true then forced redirection option will be enabled in new websites by default. default: false
  • Boolean — Forced redirection option chosen by default (1 - redirect from www to non-www, 2 - redirect from non-www to www). default: 1


  • (1) — "The software is not available for your hosting plan."
  • (2) — example shows how to add two extra buttons in builder toolbar:
    "ui" : {
        "toolbars" : {
            "control-toolbar-cont" : {
                "items" : [
                    {
                        "name" : "Prices",
                        "img" : "/path/or/url/to/prices.png",
                        "url" : "http://yoursite.com/prices",
                        "order" : 21
                    },
                    {
                        "name" : "Domains",
                        "img" : "/path/or/url/to/domains.png",
                        "url" : "http://yoursite.com/sign-up",
                        "order" : 22
                    }
                ]
            }
        }
    }
    All default builder buttons have orders multiple to 20, that is 20, 40, 60 etc.
    Parameters "name" and "url" are multilingual (please see explanation below).
  • * — Multilingual value can be either a string like:
    "disabledHostingPlansMessage": "My message"
    or an object containing values for multiple languages like:
    "disabledHostingPlansMessage": {
        "en": "My message",
        "it": "Il mio messaggio"
    }

CRON available since version 3.7.280

Setup CRON to be executed automatically every minute.
Run command crontab -e to open CRON editor.
Then append this line at the end:
* * * * * cd [BUILDER_DIR] && php cron.php
and save.

Notes:
  • [BUILDER_DIR] must be replaced with real builder web root folder path.
  • CRON setup mechanism can vary from server to server. The command above shows standard CRON setup in server console.
  • If you have multiple PHP versions on server and PHP CLI version differs from PHP WEB version used by builder then specify correct PHP executable in CRON command. For example:
    * * * * * cd [BUILDER_DIR] && /usr/bin/php7 cron.php

Currently CRON includes the following tasks:

  • builder update (run once per day) — This cron task keeps builder always up-to-date.
  • temporary/old files cleanup (run twice per day) — during builder work it accumulates some garbage (temporary/old files) which can take a lot of space with time. This cron task keeps builder clean and space optimized.
  • free disk space checking (run every 5 minutes) — This cron task checks free disk space the builder is running on. Once the disk is full it disables builder and shows corresponding message for clients. This is important because during lack of free space builder can work unpredictably and even damage clients' site data used by builder. We recommend to sometimes check free disk space on builder server and ensure that there are at least 2 GB available.
Despite the fact CRON does not execute tasks every minute, we recommend to setup it to run every minute anyways. If cron.php is executed and no task is taken that exact time then the script stops. This ensures cron mechanism performance optimization.

Cleanup available since version 3.7.263

This method is deprecated in version 3.7.280 or higher. Please use CRON method instead.

During normal use of builder, temporary files are being created, and after some time they might start using a lot of disk space.
You can use this CRON to regularly (ex. daily) cleanup those files:
Run command crontab -e to open CRON editor.
Then append this line at the end:
0 0 * * * cd [BUILDER_DIR] && php index.php /cron/cleanup/temp-files
and save.

You can also use command:
cd [BUILDER_DIR] && php index.php /cron/cleanup/temp-files?dryRun=1
to get information on how much space will be freed (running this command will not delete any files).

Note:
If you have multiple PHP versions on server and PHP CLI version differs from PHP WEB version used by builder then specify correct PHP executable in CRON command. For example:
0 0 * * * cd [BUILDER_DIR] && /usr/bin/php7 index.php /cron/cleanup/temp-files

Auto update

This method is deprecated in version 3.7.280 or higher. Please use CRON method instead.
Setup CRON to be executed automatically in specific periods of time (ex. every day).
Run command crontab -e to open CRON editor.
Then append this line at the end:
0 0 * * * cd [BUILDER_DIR] && php index.php /api/update-builder
and save.
Note: [BUILDER_DIR] must be replaced with real builder web root folder path.
Note:
If you have multiple PHP versions on server and PHP CLI version differs from PHP WEB version used by builder then specify correct PHP executable in CRON command. For example:
0 0 * * * cd [BUILDER_DIR] && /usr/bin/php7 index.php /api/update-builder

Manual update

  1. Backup (copy to a safe place) file "config.json" located in your builder web-root folder.
  2. Download site builder archive and extract it to builder installation folder overwriting all files. Important! Do not delete files before extraction:
  3. Execute SQL scripts located in folder installer/sql those which contain version number in file name equal or higher to your builder version (if any exists).
  4. Delete folder installer.
  5. Restore file "config.json" (the one you backed up/copied to a safe place in the first step) by overwriting the one that already exists.
  6. Update builder file version located in web-root folder with a new version.

Changing PHP version

If you change PHP version with already installed builder then you will need to manually update builder afterwards (see documentation) in case if PHP version changed range (from the list of PHP versions ranges specified above).