我是Debian的新手,使用Debian OS在Digital Ocean上构建服务器。我成功地将两个域添加到一个液滴中:
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 Web服务器,但尚未明确配置<VirtualHost>
与该主机名匹配的部分,则apache将提供“最佳匹配”(第一个)。
因此,如果您<VirtualHost>
的apache配置中只有一个,并且多个主机名(mysite.com
和anothersite.com
)指向同一台计算机,则所有这些名称将显示相同的虚拟主机。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句