Назад | Перейти на главную страницу

Домен виртуального хоста не попадает в нужную папку

Я пытаюсь настроить несколько веб-сайтов на одной установке Ubuntu 16.04, и до сих пор установил Ubuntu с LAMP и SSL (Letsencrypt).

Проблема: первый домен (website1.com) указывает на правильную папку (var / www / html / website1), но мой второй домен (website2.com) указывает на первый (var / www / html / website1).

Я создал файлы /etc/apache2/sites-available/website1.conf и /etc/apache2/sites-available/website2.conf и настроил их следующим образом:

Website1.conf

<IfModule mod_ssl.c><VirtualHost *:443>
ServerAdmin myemail@gmail.com
ServerName website1.com
ServerAlias www.website1.com
DocumentRoot /var/www/html/website1 
<Directory /> 
    Options FollowSymLinks 
    AllowOverride None 
</Directory>
<Directory /var/www/html/website1> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride All 
    Order allow,deny 
    allow from all
</Directory> 
    SSLCertificateFile /etc/letsencrypt/live/website2.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/website2.com/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Website2.conf

<IfModule mod_ssl.c><VirtualHost *:443>
ServerAdmin myemail@gmail.com
ServerName website2.com
ServerAlias www.website2.com
DocumentRoot /var/www/html/website2
<Directory /> 
    Options FollowSymLinks 
    AllowOverride None 
</Directory>
<Directory /var/www/html/website2> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride All 
    Order allow,deny 
    allow from all
</Directory> 
    SSLCertificateFile /etc/letsencrypt/live/website2.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/website2.com/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

apachectl -S вывод

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:443                  is a NameVirtualHost
         default server website1.com (/etc/apache2/sites-enabled/website1-le-ssl.conf:2)
         port 443 namevhost website1.com (/etc/apache2/sites-enabled/website1-le-ssl.conf:2)
             alias www.website1.com
     port 443 namevhost website2.com (/etc/apache2/sites-enabled/website2-le-ssl.conf:2)
             alias www.website2.com
*:80                   website2.com (/etc/apache2/sites-enabled/website2.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

Каждый раз, когда я пытаюсь зайти на website2.com, я попадаю прямо на website1.com.

Пожалуйста, помогите и заранее большое спасибо за ваши идеи!