【发布时间】:2019-11-29 03:01:37
【问题描述】:
我在新的 EC2 服务器上安装了 LAMP,通过公共 IP 地址,我可以看到由我的新 apache 服务器加载的默认 Ubuntu 网页。
当我在原始 html 目录旁边创建一个新目录(简称为 test)时,我的问题就开始了。在测试中,我创建了 index.html,内容为“测试页面响应和加载...”。
然后,我将/etc/apache2/sites-available/000-default.conf 复制到test.conf 并设置DocumentRoot /var/www/test。
我通过sudo a2ensite test.conf启用了虚拟主机,并通过sudo service apache2 reload重新启动了服务器。
在我的浏览器中,当我访问 IP 地址时,我得到了 apache 加载的 ubuntu 页面。然后我将/test 附加到 IP 地址的末尾,我得到 Not found: The requested URL /test was not found on this server. 错误。
出于好奇,我禁用了000-default.conf 虚拟主机,然后重新启动了服务器。 test/index.html 的输出仅使用 IP 地址加载到浏览器中 - 这是我没想到的。
ServerAdmin 网站管理员@localhost DocumentRoot /var/www/test
选项索引 FollowSymLinks 允许覆盖所有 要求所有授予
当我在浏览器中访问 .../test 时,我试图简单地提供 test/index.html。
【问题讨论】:
标签: html apache2 virtualhost