Apache2上的虚拟主机为所有主机加载相同的站点

时间:2016-09-22 05:43:11

标签: apache ubuntu configuration virtualhost vhosts

我正在使用Ubuntu 16.04.1和Apache2.4.7

我使用a2ensite启用了两个站点并重新加载了apache2。它成功重新加载,但即使是siteb.com或www.siteb.com也始终显示sitea

sitea.conf包含以下内容:

<VirtualHost *:80>
    ServerName sitea.com
    ServerAlias www.sitea.com

    ServerAdmin webmaster@localhost
    ServerRoot /home/sitea/
    DocumentRoot /home/sitea/www

    <Directory /home/sitea/www>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

siteb.conf具有以下内容:

<VirtualHost *:80>
    ServerName siteb.com
    ServerAlias www.siteb.com

    ServerAdmin webmaster@localhost
    ServerRoot /home/siteb/
    DocumentRoot /home/siteb/www

    <Directory /home/siteb/www>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

请说明我做错了什么。

0 个答案:

没有答案