Noe*_*rte 10 ubuntu apache-httpd apache-virtualhost
我在运行 Ubuntu 12.04.3 的 Digital Ocean 上使用虚拟主机运行 VPS。我可以在此处按照本教程进行设置:https : //www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts
然而,几天后,我导航到我的主域 (noelforte.com) 以检查一切是否运行顺利,但没有看到我临时设置的登录页面,而是看到了一个目录列表。
奇怪的是,我用 VHosts 配置的子域仍然指向正确的目录,但是我的主域恢复为指向/var/www
.
删除其中的配置文件/etc/apache2/sites-available
并重新设置所有内容会产生相同的结果:任何子域都将指向正确的位置,但是根 TLD 仍然停留在指向/var/www
.
什么可能导致这种情况,为什么它最初可以正常工作?
Noe*_*rte 15
解决了!运行sudo apache2ctl -S
返回以下内容:
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server noelforte.com (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost noelforte.com (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost media.noelforte.com (/etc/apache2/sites-enabled/media.noelforte.com:1)
Run Code Online (Sandbox Code Playgroud)
我决定禁用所有站点,包括默认站点,只激活我需要的站点。那解决了我的问题。
如果有人可以解释为什么像这里看到的那样noelforte.com
运行default-000
:
port 80 namevhost noelforte.com (/etc/apache2/sites-enabled/000-default:1)
Run Code Online (Sandbox Code Playgroud)
这将有助于阐明可能配置错误的内容。谢谢!