[Yandex Cloud documentation](../../../index.md) > [Yandex Managed Service for MySQL®](../../index.md) > [Tutorials](../index.md) > [1C-Bitrix online store](index.md) > Management console

# Creating an online store on 1C-Bitrix: Website Management using the management console

To create an infrastructure for an [online store on 1C-Bitrix: Website Management](index.md) using the Yandex Cloud management console:

1. [Get your cloud ready](#before-you-begin).
1. [Create and set up a cloud network](#create-network).
1. [Create a VM in the cloud](#create-vm).
1. [Create a MySQL® DB cluster](#create-mysql).
1. [Configure your VM for 1C-Bitrix](#configure-server).
1. [Configure 1C-Bitrix](#configure-bitrix).

If you no longer need the resources you created, [delete them](#clear-out).

## Get your cloud ready {#before-you-begin}

Sign up for Yandex Cloud and create a [billing account](../../../billing/concepts/billing-account.md):
1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../../../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../../../billing/quickstart/index.md) and [link](../../../billing/operations/pin-cloud.md) a cloud to it.

If you have an active billing account, you can create or select a [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).

[Learn more about clouds and folders here](../../../resource-manager/concepts/resources-hierarchy.md).

### Required paid resources {#paid-resources}

* VM instance: use of computing resources, storage, public IP address, and OS (see [Compute Cloud pricing](../../../compute/pricing.md)).
* Managed Service for MySQL® cluster: computing resources allocated to hosts, size of storage and backups (see [Managed Service for MySQL® pricing](../../pricing.md)).
* Public IP addresses if public access is enabled for cluster hosts (see [Virtual Private Cloud pricing](../../../vpc/pricing.md)).

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](https://www.1c-bitrix.ru) official website.

## Set up a cloud network {#create-network}

{% list tabs group=instructions %}

- Management console {#console}

   1. [Create a network](../../../vpc/operations/network-create.md) named `network-1`. When creating your network, disable the **Create subnets** option.
   1. In `network-1`, [create](../../../vpc/operations/subnet-create.md) two [subnets](../../../vpc/concepts/network.md#subnet) in different [availability zones](../../../overview/concepts/geo-scope.md) with the following parameters:
      1. Subnet in the `ru-central1-a` availability zone:
         * **Name**: `subnet-a`
         * **Availability zone**: `ru-central1-a`
         * **CIDR**: `192.168.0.0/24`
      1. Subnet in the `ru-central1-b` availability zone:
         * **Name**: `subnet-b`
         * **Availability zone**: `ru-central1-b`
         * **CIDR**: `192.168.1.0/24`
   1. In `network-1`, [create security groups](../../../vpc/operations/security-group-create.md):
      1. Named `bitrix-sg-vm` for your VM in the cloud. [Set rules](../../../vpc/operations/security-group-add-rule.md) for the [security group](../../../vpc/concepts/security-groups.md) based on the following table:

         | Traffic<br>direction | Description | Port range | Protocol | Source /<br>Destination name | CIDR 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` |

      1. Named `bitrix-sg` for a MySQL® database cluster. [Set rules](../../../vpc/operations/security-group-add-rule.md) for the security group based on the following table:

         | Traffic<br>direction | Description | Port range | Protocol | Source /<br>Destination name | CIDR blocks |
         --- | --- | --- | --- | --- | ---
         | Outgoing | `ANY` | `All` | `Any` | `CIDR` | `0.0.0.0/0` |
         | Incoming | `EXT-HTTPS` | `3306` | `TCP` | `CIDR` | `0.0.0.0/0` |

{% endlist %}

## Create a VM in the cloud {#create-vm}

{% list tabs group=instructions %}

- Management console {#console}

  1. On the [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) page in the [management console](https://console.yandex.cloud), click ![plus](../../../_assets/console-icons/plus.svg) **Create resource** and select `Virtual machine instance`.
  1. Under **Boot disk image**, in the **Product search** field, enter `Ubuntu 22.04 LTS` and select a public [Ubuntu 22.04 LTS](https://yandex.cloud/en/marketplace/products/yc/ubuntu-22-04-lts) image.
  1. Under **Location**, select the `ru-central1-a` [availability zone](../../../overview/concepts/geo-scope.md).
  1. Under **Disks and file storages**, select the `SSD` [disk type](../../../compute/concepts/disk.md#disks_types) and specify its size: `24 GB`.
  1. Under **Computing resources**, navigate to the `Custom` tab and specify the [platform](../../../compute/concepts/vm-platforms.md), number of vCPUs, and amount of RAM:

      * **Platform**: `Intel Ice Lake`
      * **vCPU**: `2`
      * **Guaranteed vCPU performance**: `20%`
      * **RAM**: `4 GB`

  1. Under **Network settings**:

      * In the **Subnet** field, select the network named `network-1` and the subnet named `subnet-a`.
      * Under **Public IP address**, 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.

  1. Under **Access**, select **SSH key** and specify the VM access credentials:

      * In the **Login** field, enter a username, e.g., `ubuntu`. Do not use `root` or other names reserved for the OS purposes. To perform operations requiring root privileges, use the `sudo` command.
      * In the **SSH key** field, select the SSH key saved in your [organization user](../../../organization/concepts/membership.md) profile.
        
        If there are no SSH keys in your profile or you want to add a new key:
        
        1. Click **Add key**.
        1. Enter a name for the SSH key.
        1. Select one of the following:
        
            * `Enter manually`: Paste the contents of the public SSH key. You need to [create](../../../compute/operations/vm-connect/ssh.md#creating-ssh-keys) an SSH key pair on your own.
            * `Load from file`: Upload the public part of the SSH key. You need to create an SSH key pair on your own.
            * `Generate key`: Automatically create an SSH key pair.
            
              When adding a new SSH key, an archive containing the key pair will be created and downloaded. In Linux or macOS-based operating systems, unpack the archive to the `/home/<user_name>/.ssh` directory. In Windows, unpack the archive to the `C:\Users\<user_name>/.ssh` directory. You do not need additionally enter the public key in the management console.
        
        1. Click **Add**.
        
        The system will add the SSH key to your organization user profile. If the organization has [disabled](../../../organization/operations/os-login-access.md) the ability for users to add SSH keys to their profiles, the added public SSH key will only be saved in the user profile inside the newly created resource.

  1. Under **General information**, specify the VM name: `bitrixwebsite`.
  1. Click **Create VM**.

  You may need to save [disk snapshots](../../../compute/operations/disk-control/create-snapshot.md) 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](../../../compute/concepts/backups.md) before performing operations that can damage your data.
  * Performing disk versioning by [creating snapshots on a regular basis](../../../compute/operations/disk-control/configure-schedule.md).

{% endlist %}

## Create a MySQL® DB cluster {#create-mysql}

{% list tabs group=instructions %}

- Management console {#console}

  1. On the folder page in the [management console](https://console.yandex.cloud), click ![plus](../../../_assets/console-icons/plus.svg) **Create resource** and select **MySQL cluster**.
  1. In the **Cluster name** field, enter a name for the cluster, e.g., `BitrixMySQL®`.
  1. Under **Host class**, select `s3-c2-m8`. This configuration is enough for 1C-Bitrix to run.
  1. Under **Storage size**, set [storage type](../../concepts/storage.md) to `network-ssd` and size to `10 GB`.
  1. Under **Database**, specify:
     * **DB name**. In this tutorial, keep the default value, `db1`.
     * **Username** which serves as a username for connecting to the DB. In this tutorial, keep the default value, `user1`.
     * **Password** for 1C-Bitrix to access the MySQL® database, e.g., `p@s$woRd!`.
  1. Under **Network settings**:
     * In the **Network** field, select `network-1` you created earlier.
     * In the **Security groups** field, select `bitrix-sg`.
  1. Under **Hosts**, change the availability zone for the database if required. Do this by clicking ![pencil](../../../_assets/console-icons/pencil.svg) in the host info line. In the window that opens, select the availability zone and click **Save**.

     We recommend selecting the same availability zone as for the VM you created. This reduces latency between the VM and the DB.

  1. 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.
  1. Leave the other fields unchanged.
  1. Click **Create cluster**.

  Creating a DB cluster may take a few minutes. To check that the new cluster is available, select **Managed Service for&nbsp;MySQL** in the Yandex Cloud management console. On the **Clusters** tab, the cluster's status must be `Running` and its state, `Alive`.

{% endlist %}

## Configure your VM for 1C-Bitrix {#configure-server}

To configure a server for 1C-Bitrix:
1. [Connect](../../../compute/operations/vm-connect/ssh.md) to the VM over SSH on behalf of the user specified when [creating the VM](#create-vm), e.g., `ubuntu`:

   ```bash
   ssh ubuntu@<VM_public_IP_address>
   ```

   You can look up the VM's public IP address in the [management console](https://console.yandex.cloud) by checking the **Public IPv4 address** field under **Network** on the VM page.

1. Install the required software:

   {% note info %}

   The below install commands are for Ubuntu. For other distributions, use the relevant commands of your packet manager.

   {% endnote %}

   ```bash
   sudo apt-get update
   sudo apt-get install -y apache2 libapache2-mod-php php-gd php-mbstring php-mysql
   ```

1. Go to the project's working folder and download the 1C-Bitrix: Site Management distribution:

   ```bash
   cd /var/www/html/
   sudo wget https://www.1c-bitrix.ru/download/business_encode.tar.gz
   ```

1. Unpack the downloaded archive and delete unnecessary files:

   ```bash
   sudo tar -zxf business_encode.tar.gz
   sudo rm -f index.html business_encode.tar.gz
   ```

1. Make the `www-data` user the owner of the project's working folder:

   ```bash
   sudo chown -R www-data:www-data /var/www/html
   ```

   Check the permissions and owners of the working folder:

   ```bash
   ls -l
   ```

   Result:

   ```text
   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
   ```

1. For 1C to work correctly, configure the PHP settings. To do this, use the built-in `nano` editor and modify the following variables in the `php.ini` configuration file:

   ```bash
   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 version `8.1`. For `8.0`, enter `/etc/php/8.0/apache2/php.ini`; for `8.2`, `/etc/php/8.2/apache2/php.ini`, etc.

   {% note 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**.

   {% endnote %}

1. Configure the Apache web server. To do this, edit the `/etc/apache2/sites-enabled/000-default.conf` configuration file.
   1. Open the file in the text editor:

      ```bash
      sudo nano /etc/apache2/sites-enabled/000-default.conf
      ```

   1. After the `DocumentRoot /var/www/html` line, add the following section and save the changes:

      ```html
      <Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
      </Directory>
      ```

   1. Restart the web server to apply all the updated settings:

      ```bash
      sudo systemctl restart apache2
      ```

After you run these commands, the server side will be configured for 1C-Bitrix to work correctly.

## Configure 1C-Bitrix {#configure-bitrix}

Install and configure 1C-Bitrix:

1. Open the 1C-Bitrix: Site Management web interface. Do it by going to `http://<VM_public_IP_address>/` in your browser. A page will open prompting you to install 1C-Bitrix.

1. Click **Next** on the installer welcome screen.

   ![Step 1](../../../_assets/tutorials/bitrix-shop/bitrix-shop1.png)

1. Read the license agreement and select **I accept the license agreement**. Then click **Next**.

   ![Step 2](../../../_assets/tutorials/bitrix-shop/bitrix-shop2.png)

1. 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**.

   ![Step 3](../../../_assets/tutorials/bitrix-shop/bitrix-shop3.png)

1. 1C-Bitrix will check if the server is configured correctly. Click **Next** at the bottom of the page.

   ![Step 4](../../../_assets/tutorials/bitrix-shop/bitrix-shop4.png)

1. Configure the database:
   1. In the **Server** field, enter the fully qualified domain name (FQDN) of the DB you created. To find out this name:
      1. In the [management console](https://console.yandex.cloud), open the folder page in a new browser tab.
      1. Navigate to **Managed Service for&nbsp;MySQL**.
      1. In the window that opens, select the `BitrixMySQL` cluster you created earlier.
      1. Select the **Hosts** tab in the left-hand menu.
      1. In the **Host FQDN** field, hover over the host name (format: `rc1c-cfazv1db********`) and copy the database FQDN by clicking ![copy](../../../_assets/copy.svg). The FQDN will be added to the host name, so the **Server** field should contain a name in `rc1c-cfazv1db********.mdb.yandexcloud.net` format.
   1. In the **Username** and **Password** fields, enter the data that you specified when creating the DB in [Create a MySQL® DB cluster](#create-mysql).
   1. In the **Database name** field, specify the name of the new database (`db1`).
   1. Click **Next**.

   ![Step 5](../../../_assets/tutorials/bitrix-shop/bitrix-shop5.png)

1. Wait for the system installation and DB initialization to complete.

   ![Step 6](../../../_assets/tutorials/bitrix-shop/bitrix-shop6.png)

1. Create an administrator (a user to manage the system). Fill in the fields with your personal data and click **Next**.

   ![Step 7](../../../_assets/tutorials/bitrix-shop/bitrix-shop7.png)

1. Select the **Online store** template and click **Next**.

   ![Step 8](../../../_assets/tutorials/bitrix-shop/bitrix-shop8.png)

1. Confirm the selection of the only template and click **Next**.

   ![Step 9](../../../_assets/tutorials/bitrix-shop/bitrix-shop9.png)

1. Select a color for the previously selected template and click **Next**.

   ![Step 10](../../../_assets/tutorials/bitrix-shop/bitrix-shop10.png)

1. Fill in the fields according to your requirements for the online store and click **Next**.

   ![Step 11](../../../_assets/tutorials/bitrix-shop/bitrix-shop11.png)

1. If necessary, enable the inventory management function and specify when to reserve items at the warehouse. Click **Next**.

   ![Step 12](../../../_assets/tutorials/bitrix-shop/bitrix-shop12.png)

1. Enter your company information and click **Next**.

   ![Step 13](../../../_assets/tutorials/bitrix-shop/bitrix-shop13.png)

1. Select the types of payers your online store will work with and click **Next**.

   ![Step 14](../../../_assets/tutorials/bitrix-shop/bitrix-shop14.png)

1. Select the payment and delivery methods your online store supports and click **Next**.

   ![Step 15](../../../_assets/tutorials/bitrix-shop/bitrix-shop15.png)

1. Wait for the system installation to complete.

   ![Step 16](../../../_assets/tutorials/bitrix-shop/bitrix-shop16.png)

1. Once the installation is complete, click **Go to website**.

   ![Step 17](../../../_assets/tutorials/bitrix-shop/bitrix-shop17.png)

1. The online store interface will open in edit mode.

   ![Step 18](../../../_assets/tutorials/bitrix-shop/bitrix-shop18.png)

1. 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.

   ![Step 19](../../../_assets/tutorials/bitrix-shop/bitrix-shop19.png)

{% note tip %}

To get system backups, [create disk snapshots](../../../compute/operations/disk-control/create-snapshot.md) on your VM from time to time.

{% endnote %}

## How to delete the resources you created {#clear-out}

To stop paying for the resources you created:
1. [Delete](../../../compute/operations/vm-control/vm-delete.md) the `bitrixwebsite` VM.
1. [Delete](../../operations/cluster-delete.md) the `BitrixMySQL®` cluster database.

If you reserved a static public IP address for this VM:
1. Navigate to **Virtual Private Cloud** in your folder.
1. Navigate to the **Public IP addresses** tab.
1. Find the required IP address, click ![ellipsis](../../../_assets/console-icons/ellipsis.svg), and select **Delete**.

#### Useful links {#see-also}

* [Creating an online store on 1C-Bitrix: Website Management using Terraform](terraform.md)