Manual server deployment

We do not recommend configuring the server and the platform manually. Automatic installation script for Debian 10 runs the best setup.

For the correct operation of the platform, you will need a web server with PHP version 7.2 and MySQL version 5.0 and above. The required option is a server on Debian 10 x64 without a control panel. You can configure the server using our ready-made script.

Preparing for the installation

Important! Before installing the server, make sure that the domains you need are bound to it and point to it. For this, we recommend that you specify the use of the Registrar's DNS servers in the domain settings and set the following records in the zone settings (replace 12.34.56.78 with the IP address of your server)

* A 12.34.56.78
@ A 12.34.56.78

If you are using CloudFlare or another DNS provider that does not support wildcard records (asterisk), add the following records:

@ A 12.34.56.78
www A 12.34.56.78
r A 12.34.56.78
pms A 12.34.56.78

If the primary domain is not bound to the server, the installation may fail. Be sure to wait for the domain binding. It usually takes a couple of hours.

Deploying the server

Connect to your clean server on Debian 9 via SSH as root. If necessary, set a new root password on the server. Connect to your clean server on Debian 10 via SSH as root and enter the following commands:

wget https://cpa.st/setup/d10n.sh
bash d10n.sh <hostname.com>

Where instead <hostname.com> specify the address of your primary domain to which the license is bound. Do not use www and angle brackets! For example so:

bash d10n.sh demo.altercpa.pro

Installation will take place automatically within 3-5 minutes.

This script will configure the server and prepare folders for domains. The data to connect to the server will remain in the config file.txt in the /root folder. This file will specify the settings for connecting to the server via SFTP, access to phpMyAdmin and the password from the cpa database for further installation of the system.

Some useful files and folders on your server

  1. /root/config - this file is responsible for the most important configurations of your server.
  2. /root/ssl-domains.txt - list of domains for which you want to create SSL certificates.
  3. /backup - here you will find the last seven backups of your files, sorted by date.
  4. /var/www - this folder stores your sites. Each domain has its own folder.

Adding and removing domains

To work with the list of domains associated with the server, you need to create folders with domain names in the /var/www directory and set their settings in the NGinx configuration files. It is necessary to create folders through FTP as a wsvr user.

Configuration must be done over SSH as root. A sample configuration file is located in /etc/nginx/conf.d/site.conf-dist. You need to copy this file into the same folder and name it site.conf, where instead of "site" use any convenient name. In the file itself, replace all "sitename.com" with the address of the connected domain and save the file. Create a folder with the name of the connected domain in /var/log/www/.

To activate NGinx with new settings, be sure to check the resulting configuration files for errors:

nginx -t

If this command says everything is Ok, restart NGinx.

service nginx restart

Get free SSL certificates and enable HTTPS

To ensure that the domains worked on HTTPS, you need to add them to the list in the file ssl-domains.txt in the /root folder. Each line in this file contains one domain and its aliases separated by a space. The first domain in the list should always be specified without www and match the folder created in /var/www to which it will be bound. After you save the list of domains, run the following command as root in the home folder:

./recert

This command will update the certificates on your server. To activate HTTPS on the domain itself, uncomment and correct the corresponding directives in the domain’s .conf file.

Binding sites to different server IP addresses

Open the .conf file of the required domain in /etc/nginx/conf.d/ and in the appropriate server add the listen directives for the corresponding IP addresses.

listen 1.2.3.4:80;
listen 1.2.3.4:443 ssl http2;

Restart the web server with the command service nginx restart.

Backup to the cloud

You can configure storage of the most recent backup in the cloud with WebDav support. To do this, uncomment the lines in the /root/config file:

WEBDAVUSER="me@ya.ru"
WEBDAVPASS="pass"
WEBDAVPATH="https://webdav.yandex.ru/backup"

And specify the username, password and path to your WebDav provider. Add three folders on the side of the cloud in the path you specified: db, html, system.