发布于 2017-10-15 13:15:17 | 164 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

Apache Web服务器

Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件。


这篇文章主要介绍了Apache控制是否显示站点目录(推荐)的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下

加载 mod_autoindex 模块

Apache 2.4版本,如果要控制站点目录是否显示,需要 mod_autoindex 模块。如果没有该模块,显示站点目录的指令无效。

加载该模块

LoadModule autoindex_module modules/mod_autoindex.so

方法一

解决过程:首先查看apache官网文档,不能快速找到需要的部分。用搜索引擎查找“apache显示站点目录”,找到相关资料,雷同。按照资料说明配置无效。

开始尝试在虚拟主机和非虚拟主机尝试资料中的配置,仍然无效。再回到官网文档查找关键词“Options Indexes”,看到“mod_autoindex can generate a listing of the directory contents”,

然后全文检索httpd.conf,意识到是因为相关模块没有加载。

虚拟主机显示站点目录

apache 2.4版本默认不显示站点目录,虚拟主机配置如下:


<VirtualHost *:80>
ServerAdmin chuganghong@qq.com
DocumentRoot "E:\wamp64\www\my-site\test-php"
ServerName test-php.com
ErrorLog "logs/test-php.com-error.log"
CustomLog "logs/test-php.com-access.log" common
</VirtualHost>

加入显示站点目录的指令 Options +Indexes,完整代码如下:


<VirtualHost *:80>
<Directory "E:\wamp64\www\my-site\test-php">
Options +Indexes # 显示站点目录
</Directory>
ServerAdmin chuganghong@qq.com
DocumentRoot "E:\wamp64\www\my-site\test-php"
ServerName test-php.com
ErrorLog "logs/test-php.com-error.log"
CustomLog "logs/test-php.com-access.log" common
</VirtualHost>

Options +Indexes 或 Options Indexes 或没有这条指令,显示站点目录。

Options -Indexes,禁止显示站点目录。

以上所述是小编给大家介绍的Apache控制是否显示站点目录,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对PHPERZ网站的支持!



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务