域被重定向到同一液滴中的另一个域
Domain is redirected to another domain in same droplet
好吧,我是 Debian 新手,用 Debian 在 Digital Ocean 上构建服务器 OS。
我成功地将两个域添加到一个 droplet 中:
mysite.com
anothersite.com
创建了新目录:
/home/user/www/mysite.com/public_html
并将文件复制到 public_html
/etc/apache2/sites-available
里面的配置文件是:
DocumentRoot /home/user/www/mysite.com/public_html
<Directory /home/user/www/mysite.com/public_html>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/myproject-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/myproject-access.log combined
当然,我启用了网站。
我没有编辑 apache2.conf
文件,也没有配置第二个域 (anothersite.com
)。刚刚将这个第二个域添加到 Droplet,仅此而已。
当我进入网站时 mysite.com
它运行完美。但我想知道为什么第二个域 (anothersite.com
) 被重定向到第一个 (mysite.com
) 域?
对了,我用的是Apache 2.4
如果主机名(例如 anothersite.com)指向 apache 网络服务器但没有明确配置与该主机名匹配的部分,则 apache 将提供 "best match"(第一个)。
所以如果只有一个 apache 配置和多个主机名(mysite.com 和 anothersite.com)指向同一台机器,所有这些名称将显示相同的虚拟主机
好吧,我是 Debian 新手,用 Debian 在 Digital Ocean 上构建服务器 OS。 我成功地将两个域添加到一个 droplet 中:
mysite.com
anothersite.com
创建了新目录:
/home/user/www/mysite.com/public_html
并将文件复制到 public_html
/etc/apache2/sites-available
里面的配置文件是:
DocumentRoot /home/user/www/mysite.com/public_html
<Directory /home/user/www/mysite.com/public_html>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/myproject-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/myproject-access.log combined
当然,我启用了网站。
我没有编辑 apache2.conf
文件,也没有配置第二个域 (anothersite.com
)。刚刚将这个第二个域添加到 Droplet,仅此而已。
当我进入网站时 mysite.com
它运行完美。但我想知道为什么第二个域 (anothersite.com
) 被重定向到第一个 (mysite.com
) 域?
对了,我用的是Apache 2.4
如果主机名(例如 anothersite.com)指向 apache 网络服务器但没有明确配置与该主机名匹配的部分,则 apache 将提供 "best match"(第一个)。
所以如果只有一个 apache 配置和多个主机名(mysite.com 和 anothersite.com)指向同一台机器,所有这些名称将显示相同的虚拟主机