Preparing a VDS server for Bitrix

May 22, 2023 Author: korjeek

Starting tasks on bare VSD

Tools

  1. Pytty + configured ROOT connection
  2. Hosting + Account
  3. WinCSP + configured connection
  4. Notepad++

User preparation

In Ubuntu, it is highly discouraged to work under the ROOT account, so first we will create our own user with sudo rights

  1. List all users: nano /etc/passwd
  2. Create a new user with console sudo useradd -s /bin/bash username
  3. Set password for user sudo passwd username
  4. Make user sudo usermod -aG sudo username
  5. Login as username.
  6. Create a home directory: sudo mkdir /home/username
  7. Reconnect with user rush
  8. Add the user to the www-data group sudo usermod -a -G www-data username

Software installation and system update

  1. Get information about the latest package versions: sudo apt-get update
  2. Install MC: sudo apt-get install mc
  3. Install tasksel: sudo apt-get install tasksel
  4. Install git: sudo apt-get install git

Installing LAMP

  1. Running installation sudo tasksel install lamp-server
  2. Generate mysql password using http://www.onlinepasswordgenerator.ru/ – 10 characters with special characters
  3. Filling in the password on the “Project Information” board
  4. Set the mysql root password in the console GUI
  5. Installation will complete
  6. Starting Apache sudo /etc/init.d/apache2 restart

Apache setup

  1. Check availability by ip – in the browser as the IP address of the server. If everything is ok – show the page Apache
  2. Create a copy of the Apache configuration file
    sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/yoursite.conf
  3. Connect to the server via root account using WinCSP
  4. Create a site folder via WinCSP or console
  5. Create a test index.html in the site folder
  6. Edit /etc/apache2/sites-available/yoursite.conf

    ServerAdmin [email protected]
    DocumentRoot /var/www/yoursite
    ErrorLog /var/www/yoursite_error.log
    CustomLog /var/www/yoursite_access.log combined
  7. Deactivating the old site sudo a2dissite 000-default
  8. Activating a new site sudo a2ensite yoursite
  9. Apache restart sudo service apache2 restart
  10. If everything is OK, then when you go to ip, our test page will be displayed.
  11. /etc/apache2/apache2.conf

    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

Configuring Apache Modules

  1. sudo apt-get install php-mbstring
  2. sudo phpenmod mbstring
  3. sudo phpenmod mcrypt
  4. sudo a2enmod rewrite
  5. sudo a2enmod ssl
  6. sudo service apache2 restart

Installing phpmyadmin

  1. sudo apt-get install phpmyadmin php-mbstring php-gettext
  2. sudo service apache2 restart

MySQL setup

  1. In /etc/mysql/conf.d file
    [mysqld]
    sql_mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVI
    SION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
  2. sudo service mysql restart

Setting permissions

  1. We need to set the owner/group for the root directory (and any internal directories and files): sudo chown -R www-data:www-data /var/www
  2. So that no one except the current user (www-data) has access to the contents of the web-root directory. sudo chmod go-rwx /var/www
  3. Next, you need to allow users from the same group (and ‘other’) to open the /var/www directory sudo chmod go+x /var/www
  4. Next, change the permissions of all directories and files in the root directory for the same group (www-data): sudo chgrp -R www-data /var/www
  5. Use chmod commands to make it so that only one user can access content: sudo chmod -R go-rwx /var/www
  6. Make it so that any user in the same group can read/write and execute directories and files in the root directory on the server: sudo chmod -R g+rx /var/www
  7. Personally, I gave the group write permission – this is necessary for those users who edit content. It looks like this: sudo chmod -R g+rwx /var/www

php setup

/etc/php/7.0/apache2/php.ini after changing – Apache restart and check via phpinfo.php

  1. short_open_tag = On
  2. mbstring.internal_encoding = UTF-8
  3. mbstring.func_overload = 2

Site transfer to Bitrix. Preparing to deploy a backup.

Often the server bears the name of the domain that will be spinning on it. This gives rise to the following problem: ping from the VDS server to the domain goes to 127.0.0.1, and to deploy a copy, you need to knock on the “hosting” IP address by the domain name.

To edit in the /etc/hosts file of the VDS server, write a line like
87.236.16.31 yoursite.ru

And comment the line like
127.0.1.1 yoursite.ru yoursite

to make it look like this:
# 127.0.1.1 yoursite.ru yoursite

save and run check
ping yoursite.ru

After deploying the backup, we return everything as it was! Otherwise, when changing edits, edits will be made to the “old” battle site.

Preparing a backup on combat

  1. Check free space on the battlefield through hosting, if there is not enough space – temporarily increase the disk quota
  2. Create a full backup of Bitrix on the production site
  3. Download the restore.php file from there
  4. We place it in the root of the site folder
  5. Run by IP http://yourip/restore.php
  6. Act on system requests.
  7. Waiting for deployment.

Preparing the migrated site

  1. Go to Bitrix admin panel by IP in VDS
  2. Check http://yourip/bitrix/admin/site_checker.php?lang=ru
  3. If everything is OK, proceed.

Leave a Reply

Your email address will not be published. Required fields are marked *

Begin work on your project today
Contact us on Telegram. Ask a question and get a quick response.
or
Message
in Telegram
By clicking the button, you give your consent to the processing of personal data and agree to the privacy policy.