Building a 1C-Bitrix website using the management console
To create an infrastructure for your 1C-Bitrix website using the Yandex Cloud management console:
- Prepare your cloud.
- Create and set up a cloud network.
- Create a VM in the cloud.
- Create a MySQL® DB cluster.
- Configure a server for 1C-Bitrix.
- Configure 1C-Bitrix.
If you no longer need the resources you created, delete them.
Prepare your cloud
Sign up for Yandex Cloud and create a billing account:
- Go to the management console
and log in to Yandex Cloud or create an account if you do not have one yet. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one.
If you have an active billing account, you can go to the cloud page
Learn more about clouds and folders.
Required paid resources
1C-Bitrix server and database support cost includes:
- Fee for Yandex Compute Cloud disks and a continuously running VM (see Compute Cloud pricing).
- Fee for using a dynamic or static public IP address (see Yandex Virtual Private Cloud pricing).
- Fee for using a managed DB (see Managed Service for MySQL® pricing).
This tutorial uses the trial version of 1C-Bitrix with a 30-day trial period. You can check the cost of the product software versions on the 1C-Bitrix
Create and set up a cloud network
- Create a network named
network-1
. When creating your network, disable the Create subnets option. - In
network-1
, create two subnets in different availability zones with the following parameters:- Subnet in the
ru-central1-a
availability zone:- Name:
subnet-a
- Zone:
ru-central1-a
- CIDR:
192.168.0.0/24
- Name:
- Subnet in the
ru-central1-b
availability zone:- Name:
subnet-b
- Zone:
ru-central1-b
- CIDR:
192.168.1.0/24
- Name:
- Subnet in the
- In
network-1
, create security groups:-
Named
bitrix-sg-vm
for your VM in the cloud. Set rules for the security group based on the following table:Traffic
directionDescription Port range Protocol Source /
Destination nameCIDR blocks Outgoing ANY
All
Any
CIDR
0.0.0.0/0
Incoming HTTP
80
TCP
CIDR
0.0.0.0/0
Incoming EXT-HTTPS
443
TCP
CIDR
0.0.0.0/0
Incoming SSH
22
TCP
CIDR
0.0.0.0/0
-
Named
bitrix-sg
for a MySQL® database cluster. Set rules for the security group based on the following table:Traffic
directionDescription Port range Protocol Source /
Destination nameCIDR blocks Outgoing ANY
All
Any
CIDR
0.0.0.0/0
Incoming EXT-HTTPS
3306
TCP
CIDR
0.0.0.0/0
-
Create a VM in the cloud
- On the folder page in the management console
, click Create resource and select Virtual machine instance. - Under General information:
- In the Name field, enter a name for your VM, e.g.,
bitrixwebsite
. - In the Availability zone field, select
ru-central1-a
.
- In the Name field, enter a name for your VM, e.g.,
- Under Boot disk image, go to the Marketplace tab and click Show all Marketplace products. Select Ubuntu 20.04 lts as the operating system image.
- Under Disks and file storages, select
SSD
and set the size to24 GB
. - Under Computing resources, navigate to the Custom tab and configure as follows:
- Platform:
Intel Ice Lake
- vCPU:
2
- Guaranteed vCPU performance:
20%
- RAM:
4 GB
- Platform:
- Under Network settings:
- In the Subnet field, select the
subnet-a
subnet you created earlier. - Under Public IP, keep
Auto
to assign your VM a random public IP address from the Yandex Cloud pool, or select a static address from the list if you reserved one in advance. - In the Security groups field, select the
bitrix-sg-vm
security group.
- In the Subnet field, select the
- Under Access, specify the information required to access the VM:
- In the Login field, enter a username for the user to be created on the virtual machine, e.g.,
ubuntu
. - In the SSH key field, paste your public SSH key. You need to create an SSH key pair yourself.
- In the Login field, enter a username for the user to be created on the virtual machine, e.g.,
- Click Create VM.
You may need to save disk snapshots of your VM. They contain a copy of the VM file system from when the snapshot was created.
You can use disk snapshots for various purposes, e.g.:
- Migrating data from one disk to another, for example, to a disk in a different availability zone.
- Creating a disk backup before performing operations that can damage your data.
- Performing disk versioning by creating snapshots on a regular basis.
Create a MySQL® DB cluster
-
On the folder page in the management console
, click Create resource and select MySQL cluster. -
In the Cluster name field, enter the cluster name, e.g.,
BitrixMySQL®
. -
Under Host class, select
s3-c2-m8
. This configuration is enough for 1C-Bitrix to run. -
Under Size of storage, set storage type to
network-ssd
and size to10 GB
. -
Under Database, specify:
- DB name. In this tutorial, leave the default value,
db1
. - Username which serves as a username for connecting to the DB. In this tutorial, leave the default value,
user1
. - Password for 1C-Bitrix to access the MySQL® database, e.g.,
p@s$woRd!
.
- DB name. In this tutorial, leave the default value,
-
Under Network settings:
- In the Network field, select
network-1
you created earlier. - In the Security groups field, select the
bitrix-sg
security group.
- In the Network field, select
-
Under Hosts, change the availability zone for the database if required. To do this, click
in the line containing host info. In the window that opens, select the availability zone and click Save.We recommend selecting the same availability zone as when you created the VM. This reduces latency between the VM and the DB.
-
To make your DB fault-tolerant, you can add more hosts for it. To do this, click Add host and specify the availability zone to place it in.
-
Leave the other fields unchanged.
-
Click Create cluster.
Creating a DB cluster may take a few minutes. To check that the new cluster is available, select Managed Service for MySQL in the Yandex Cloud management console. On the Clusters tab, the cluster status must be Running
and its state, Alive
.
Configure a server for 1C-Bitrix
To configure a server for 1C-Bitrix:
-
Connect to the VM over SSH on behalf of the user specified when creating the VM, e.g.,
ubuntu
:ssh ubuntu@<VM_public_IP_address>
You can look up the VM's public IP address in the management console
by checking the Public IPv4 address field under Network on the VM page. -
Install the required software:
sudo apt-get update sudo apt-get install -y apache2 libapache2-mod-php php-gd php-mbstring php-mysql
-
Go to the project's working directory and download the 1C-Bitrix: Site Management distribution:
cd /var/www/html/ sudo wget https://www.1c-bitrix.ru/download/business_encode.tar.gz
-
Unpack the downloaded archive and delete unnecessary files:
sudo tar -zxf business_encode.tar.gz sudo rm -f index.html business_encode.tar.gz
-
Make the
www-data
user the owner of the project's working directory:sudo chown -R www-data:www-data /var/www/html
Check the permissions and owners of the working folder:
ls -l
Result:
total 40 drwxrwxr-x 7 www-data www-data 4096 Jun 8 2023 bitrix -rwxrwxr-x 1 www-data www-data 1150 Nov 30 2020 favicon.ico -rwxrwxr-x 1 www-data www-data 1353 Jun 8 2023 index.php -rwxrwxr-x 1 www-data www-data 268 Apr 17 2023 install.config -rwxrwxr-x 1 www-data www-data 12821 Mar 18 2022 readme.html -rwxrwxr-x 1 www-data www-data 112 Mar 27 2013 readme.php drwxrwxr-x 2 www-data www-data 4096 Jun 8 2023 upload
-
For 1C to work correctly, configure the PHP settings. To do this, use the built-in
nano
editor and modify the following variables in thephp.ini
configuration file:sudo nano /etc/php/8.1/apache2/php.ini
Previously Now short_open_tag = Off
short_open_tag = On
memory_limit = 128M
memory_limit = 256M
;date.timezone =
date.timezone = Europe/Moscow
;opcache.revalidate_freq =2
opcache.revalidate_freq =0
;session.save_path = "/var/lib/php/sessions"
session.save_path = "/var/lib/php/sessions"
The
php.ini
file path depends on the PHP version installed. The example shows the path for version8.1
. For version8.0
, enter/etc/php/8.0/apache2/php.ini
, for version8.2
, enter/etc/php/8.2/apache2/php.ini
, and so on.Tip
To find the parameter you need in the
nano
editor, press Ctrl + W. Find the required parameter from the table above and save the changes using Ctrl + O. To exit the editor, press Ctrl + X. -
Configure the Apache web server. To do this, edit the
/etc/apache2/sites-enabled/000-default.conf
configuration file.-
Open the file in the text editor:
sudo nano /etc/apache2/sites-enabled/000-default.conf
-
Add the following section after the
DocumentRoot /var/www/html
line and save the changes:<Directory /var/www/html> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
-
Restart the web server to apply all the updated settings:
sudo systemctl restart apache2
-
After you run these commands, the server side will be configured for 1C-Bitrix to work correctly.
Configure 1C-Bitrix
Install and configure 1C-Bitrix:
-
Open the 1C-Bitrix: Site Management web interface at
http://<VM_public_IP_address>/
. This should open a page prompting you to install 1C-Bitrix. -
Click Next.
-
Read the license agreement and select I accept the license agreement. Then click Next.
-
Registration is optional, so you can uncheck the corresponding checkbox, but leave Install in UTF-8 encoding and click Next.
-
1C-Bitrix will check if the server is configured correctly. View the parameters on this page and click Next.
-
Configure the database:
- In the Server field, enter the fully qualified domain name (FQDN) of the DB you created. To find out this name:
- In the management console
, open the folder page in a new browser tab. - In the list of services, select Managed Service for MySQL.
- In the window that opens, select the
BitrixMySQL
cluster you created earlier. - Select the Hosts tab in the left-hand menu.
- In the Host FQDN field, hover over the host name (format:
rc1c-cfazv1db********
) and copy the database FQDN by clicking the icon that appears. The FQDN will be added to the host name, so the Server field should contain a name inrc1c-cfazv1db********.mdb.yandexcloud.net
format.
- In the management console
- In the Username and Password fields, enter the data that you specified when creating the DB in Create a MySQL® DB cluster.
- In the Database name field, specify the name of the created DB (
db1
). - Click Next.
- In the Server field, enter the fully qualified domain name (FQDN) of the DB you created. To find out this name:
-
Wait for the MySQL® DB to initialize.
-
Create an administrator account authorized to make changes to your system. Fill in all the fields and click Next.
-
Select the Information portal template and click Next.
-
Confirm the selection of the only layout template available and click Next.
-
Select a color and click Next.
-
Fill in all the fields according to your website requirements and click Install to start the installation and configuration of all the system components. Wait for its completion.
-
After a while, a notification page will open to inform you that the system is installed and configured. To start using the website, click Go to website.
-
You can now start working with the ready-to-use web interface in content editing mode.
-
To view the website home page as a user, exit your website administration mode. To do this, click Exit in the top-right corner of the page and go to
http://<VM_public_IP_address>/
.
To return to edit mode, log in to the website using the administrator credentials you provided when configuring 1C-Bitrix.
How to delete the resources you created
To stop paying for the resources you created:
If you reserved a static public IP address specifically for this VM:
- Select Virtual Private Cloud in your folder.
- Go to the IP addresses tab.
- Find the required IP address, click
, and select Delete.