Master site deployment

CPA network based on AlterCPA platform consists of two main parts: control panel and site storage. To ensure the reliability of the system and even load distribution, each of these elements can be placed on separate servers.

System requirements

We recommend the following software platform:

  • Server (virtual or dedicated) based on Linux-like system (Debian 11 x64 is strongly recommended)
  • Web server: nginx (recommended)
  • PHP ver 7.2 and futher (depending on the PHP version, the required system archive is downloaded)
  • ionCube Loader 10 for appropriate PHP version
  • PHP-modules curl, gd, xml, mbstring, iconv, json, mysqli (for control panel), soap (for delivery services), memcache/memcached (recommended) or apcu, active support for short_open_tag in the PHP configuration
  • MySQL (for control panel) version 5.1-5.6 or 5.7 and above with strict mode disabled, or a similar version of MariaDB (recommended)
  • MemCached server (strongly recommend) or APCu-cache
  • Programmer with knowledge of PHP at least at the basic level (required!)

MySQL database is required only on the server on which the control panel will be installed. You definitely need a specialist with knowledge of server administration and PHP. Platform deployment requires appropriate knowledge. You can order the platform deployment from our specialists. Install the system only on virtual private server or dedicated server. Shared hostings are not supported

Launch preparations

Let's say that our affiliate network is located at an unreal address https://domain.com/, its control panel is located on the domain domain.com, and the site storage is located on r.domain.com.

If MySQL version 5.7 or higher is installed on the server, you must disable Strict Mode. To do this, create a (this exaple for Debian 9) /etc/mysql/conf.d/disable_strict_mode.cnf file with content:

[mysqld]
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Then restart MySQL with the service mysql restart command or similar for your platform.

Installation of the license

You need to install a license file "altercpa.txt." on the server and update it each time you prolong or change the license. You can get this file in the "My licenses" section by opening the appropriate purchase and clicking on the "License" button. This file should be one level above the folder where the platform is installed. For example, if the main platform site is located in folder /var/www/domain.com, then the license file should be located in /var/www. That is, the full path to this file will /var/www/altercpa.txt. In no case do not place the license file in the root folder of the domain where the platform is installed!

Launch of the control panel

For the correct operation of the control panel requires a server with PHP version 7.2 and above (recommended PHP 7.3 and above), MySQL database 5 (MariaDB recommended ) and above. Be sure that you have an ionCube Loader 10, PHP OpCache and Memcached support is desirable to speed up the work.

  1. Unzip the files from "work" folder to the root of the domain.
  2. Create a MySQL database (not required when using our server configuration script)
  3. Open the main address of the platform in a browser and specify the data to access the MySQL database.
  4. If you see a white screen, make sure that ionCube Loader 10 and the active license file altercpa.txt are installed on the server. The installation will not launch without them.
  5. Next, specify the email address and password that will be used by the chief network administrator.
  6. It is recommended for security purposes to rename the file cc.php in any other random name and enter that in the settings of the landing sites and prelanding. If you use ClickServer, file cc.php must be deleted.
  7. For additional security, you can also rename the tasks folder and replace the corresponding lines in .htaccess and file paths in crontab.

Important! Sometimes, after installing the system on Apache2, a Requested url not found error occurs. To fix it, manually extract the file .htaccess from the archive and upload it to the server via FTP. Some OS don't unpack it automatically due to security settings.

System configuration file

For manual installation, you must create a database connection configuration file. Use the config-dist.php as example. In the config.php file set the following system configuration:

  • HACK - the name of the folder hacks platform
  • SQL_HOST - MySQL server host, default: localhost
  • SQL_BASE - database name
  • SQL_USER - username
  • SQL_PASS - database password
  • SQL_PREF - the database table prefix, default: cpa_
  • SQL_CHARSET - basic database encoding, default: utf8
  • SQL_COLLATE - the encoding of the database store, default: utf8_general_ci
  • MC_HOST - MemCached server host, comment out only if vailable, default: 127.0.0.1
  • MC_PORT - the port of the MemCached server, default: 11211
  • MC_PREF - prefix for MemCached data, any 3-5 characters
  • STRICT_HOST - use only this host name, automatically redirect to
  • STRICT_HTTPS - always use HTTPS

Configuring the crontab scheduler

Files in the tasks folder must be added to the scheduler library (crontab) with frequency specification.

  • 10min.php - every 10 minutes
  • 1min.php - every minutes
  • 3min.php - every 3-5 minutes
  • 1day.php - every day at midnight

Example of crontab configuration for the platform:

*/10 * * * * php -f /var/www/cpa.ru/tasks/10min.php >/dev/null 2>&1
*/3 * * * * php -f /var/www/cpa.ru/tasks/3min.php >/dev/null 2>&1
* * * * * php -f /var/www/cpa.ru/tasks/1min.php >/dev/null 2>&1
0 0 * * * php -f /var/www/cpa.ru/tasks/1day.php >/dev/null 2>&1

Don't forget to add in the scheduler cron file for site storage.

You do not need to configure the report scheduler for the platform if you used our automatic configuration script. Everything is already done in the silent launch.

Nginx configurations

The control panel comes complete with a configuration file for Apache. For everything to work on nginx, you must use the following host configuration block:

location ~ /data/(cache|load|session|tpls|work) {
	deny all;
	return 403;
}
location ~ /tasks {
	deny all;
	return 403;
}
location / {
	try_files $uri $uri/ /index.php?$args;
}

Initial network configurations

After installing the main site, log in and explore the sections "Management" and "Settings". Configure the required settings for your network in the "General", "Sites", "Advanced" and "Finance" sections.

  1. The name and web address of the network are specified in the section "Basic".
  2. If necessary, specify the e-mail settings
  3. Hide unused partitions from the "Advanced" tab.
  4. Specify the default network currency and other "Finance" settings.

Further steps

  • Setting up site storage - required during manual server installation. If you use our server setup script, the repository is already installed and ready to work, but some additional settings are required..