当我访问我的网站时,会显示所有文件的索引,当我选择特定页面时,html无法访问文件中的图像.如何让Apache2自动启动/var/www/home.html而不是/ var/www?
您可以在虚拟主机上下文中使用DirectoryIndex指令.
来自apache网站
当客户端通过在目录名末尾指定/来请求目录索引时,DirectoryIndex指令设置要查找的资源列表.
这是一个例子:
<virtualhost *:80>
ServerName domain.com
ServerAlias www.domain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex home.html index.html
DocumentRoot /var/www
</virtualhost>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
63155 次 |
| 最近记录: |