Starting tasks on bare VSD
Tools
- Pytty + configured ROOT connection
- Hosting + Account
- WinCSP + configured connection
- 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
- List all users: nano /etc/passwd
- Create a new user with console sudo useradd -s /bin/bash username
- Set password for user sudo passwd username
- Make user sudo usermod -aG sudo username
- Login as username.
- Create a home directory: sudo mkdir /home/username
- Reconnect with user rush
- Add the user to the www-data group sudo usermod -a -G www-data username
Software installation and system update
- Get information about the latest package versions: sudo apt-get update
- Install MC: sudo apt-get install mc
- Install tasksel: sudo apt-get install tasksel
- Install git: sudo apt-get install git
Installing LAMP
- Running installation sudo tasksel install lamp-server
- Generate mysql password using http://www.onlinepasswordgenerator.ru/ – 10 characters with special characters
- Filling in the password on the “Project Information” board
- Set the mysql root password in the console GUI
- Installation will complete
- Starting Apache sudo /etc/init.d/apache2 restart
Apache setup
- Check availability by ip – in the browser as the IP address of the server. If everything is ok – show the page Apache
- Create a copy of the Apache configuration file
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/yoursite.conf - Connect to the server via root account using WinCSP
- Create a site folder via WinCSP or console
- Create a test index.html in the site folder
- 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
- Deactivating the old site sudo a2dissite 000-default
- Activating a new site sudo a2ensite yoursite
- Apache restart sudo service apache2 restart
- If everything is OK, then when you go to ip, our test page will be displayed.
- /etc/apache2/apache2.conf
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Configuring Apache Modules
- sudo apt-get install php-mbstring
- sudo phpenmod mbstring
- sudo phpenmod mcrypt
- sudo a2enmod rewrite
- sudo a2enmod ssl
- sudo service apache2 restart
Installing phpmyadmin
- sudo apt-get install phpmyadmin php-mbstring php-gettext
- sudo service apache2 restart
MySQL setup
- 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 - sudo service mysql restart
Setting permissions
- 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
- 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
- Next, you need to allow users from the same group (and ‘other’) to open the /var/www directory sudo chmod go+x /var/www
- 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
- Use chmod commands to make it so that only one user can access content: sudo chmod -R go-rwx /var/www
- 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
- 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
- short_open_tag = On
- mbstring.internal_encoding = UTF-8
- 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
- Check free space on the battlefield through hosting, if there is not enough space – temporarily increase the disk quota
- Create a full backup of Bitrix on the production site
- Download the restore.php file from there
- We place it in the root of the site folder
- Run by IP http://yourip/restore.php
- Act on system requests.
- Waiting for deployment.
Preparing the migrated site
- Go to Bitrix admin panel by IP in VDS
- Check http://yourip/bitrix/admin/site_checker.php?lang=ru
- If everything is OK, proceed.