Creating an online store with 1C-Bitrix: Site Management using the management console
To create an infrastructure for an online store with 1C-Bitrix: Site Management 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 your VM 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
The cost of supporting a 1C-Bitrix online store infrastructure includes:
- Fee for a continuously running VM (see Yandex Compute Cloud pricing).
- Fee for using a dynamic or static public IP address (see Yandex Virtual Private Cloud pricing).
- Fee for using a MySQL® 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 selectVirtual machine instance
. -
Under Boot disk image, in the Product search field, enter
Ubuntu 22.04 LTS
and select a public Ubuntu 22.04 LTS image. -
Under Location, select the
ru-central1-a
availability zone. -
Under Disks and file storages, select the
SSD
disk type and specify the size:24 GB
. -
Under Computing resources, navigate to the
Custom
tab and specify the required platform, number of vCPUs, and amount of RAM:- Platform:
Intel Ice Lake
. - vCPU:
2
. - Guaranteed vCPU performance:
20%
. - RAM:
4 GB
- Platform:
-
Under Network settings:
- In the Subnet field, select the network named
network-1
and the subnet namedsubnet-a
. - 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 network named
-
Under Access, select SSH key and specify the VM access data:
- In the Login field, enter a username, e.g.,
ubuntu
. Do not useroot
or other names reserved by the OS. To perform operations requiring superuser permissions, use thesudo
command. -
In the SSH key field, select the SSH key saved in your organization user profile.
If there are no saved SSH keys in your profile, or you want to add a new key:
- Click Add key.
- Enter a name for the SSH key.
- Upload or paste the contents of the public key file. You need to create a key pair for the SSH connection to a VM yourself.
- Click Add.
The SSH key will be added to your organization user profile.
If users cannot add SSH keys to their profiles in the organization, the added public SSH key will only be saved to the user profile of the VM being created.
- In the Login field, enter a username, e.g.,
-
Under General information, specify the VM name:
bitrixwebsite
. -
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 your VM 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>/
in your browser. A page will open prompting you to install 1C-Bitrix. -
Click Next on the installer welcome screen.
-
Read the license agreement and select I accept the license agreement. Then click Next.
-
You do not need to register the product (you can disable this option). Make sure the Install in UTF-8 encoding option is selected and click Next.
-
1C-Bitrix will check if the server is configured correctly. Click Next at the bottom of the page.
-
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 system installation and DB initialization to complete.
-
Create an administrator (a user to manage the system). Fill in the fields with your personal data and click Next.
-
Select the Online store template and click Next.
-
Confirm the selection of the only template and click Next.
-
Select a color for the previously selected template and click Next.
-
Fill in the fields according to your requirements for the online store and click Next.
-
If necessary, enable the inventory management function and specify when to reserve items at the warehouse. Click Next.
-
Enter your company information and click Next.
-
Select the types of payers your online store will work with and click Next.
-
Select the payment and delivery methods your online store supports and click Next.
-
Wait for the system installation to complete.
-
Once the installation is complete, click Go to website.
-
The online store interface will open in edit 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.
Tip
To get system backups, create disk snapshots on your VM from time to time.
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.