title: I can’t configure virtual hosts in Apache, although I do everything according to the instructions. What is the reason?
body: <p>I can’t configure virtual hosts in Apache, although I do everything according to the <a href="https://www.digitalocean.com/community/tutorials/apache-ubuntu-18-04-ru" rel="nofollow noreferrer">instructions</a>. What is the reason?
  I'm trying to configure virtual hosts in Apache, and it fails. I carry out the instruction without problems, but this does not work for me.</p>
  
  <p><strong>Ubunttu 18.04</strong>. The root directory is <strong>/var/www/html</strong></p>
  
  <p>There is an index.html and it is accessible from the network.
  Now, if you just type the address of the site in the browser, then it still displays, <strong>/var/www/html/index.php</strong>, and not the <strong>index.html</strong> from the virtual host. That is, it turns out that virtual hosts do not work at all.</p>
  
  <p>I did the following:</p>
  
  <pre><code>sudo mkdir -p /var/www/xxxxxx.xx/html
  sudo chown -R $USER:$USER /var/www/xxxxxx.xx/html
  sudo chmod -R 755 /var/www/xxxxxx.xx
  
  nano /var/www/xxxxxx.xx/html/index.html
  </code></pre>
  
  <p>Added page code here.</p>
  
  <pre><code>sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/xxxxxx.xx.conf
  sudo nano /etc/apache2/sites-available/xxxxxx.xx.conf
  </code></pre>
  
  <p>I inserted into xxxxxx.xx.conf:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerAdmin host1@gmail.com
    ServerName xxxxxx.xx
    ServerAlias www.xxxxxx.xx
    DocumentRoot /var/www/xxxxxx.xx/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    DirectoryIndex index.php
  &lt;/VirtualHost&gt;
  
  sudo a2ensite xxxxxx.xx.conf
  sudo a2dissite 000-default.conf
  sudo systemctl restart apache2
  </code></pre>
  
  <p>The directory permissions:</p>
  
  <pre><code>user1@host1:/var/www$ ls -l
  total 12
  drwxr-xr-x 3 root root 4096 Nov 14 11:05 xxxxxx.xx
  drwxr-xr-x 13 www-data www-data 4096 Nov 13 16:14 html
  drwxr-xr-x 4 user1 user1 4096 Nov 12 11:03 html-bk
  
  user1@host1:/var/www/xxxxxx.xx$ ls -l
  total 4
  drwxr-xr-x 2 user1 user1 4096 Nov 14 11:08 html
  
  user1@host1:/var/www/xxxxxx.xx/html$ ls -l
  total 4
  -rw-rw-r-- 1 user1 user1 177 Nov 14 11:08 index.html
  </code></pre>
  
  <p>What's wrong? I’m setting up Apache for the first time, yet according to the instructions, there were no errors during execution.</p>