加载 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版本默认不显示站点目录,虚拟主机配置如下:
?
1
2
3
4
5
6
7 |
<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,完整代码如下:
?
1
2
3
4
5
6
7
8
9
10 |
<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 或没有这条指令,显示站点目录。
以上所述是小编给大家介绍的Apache控制是否显示站点目录,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对快网idc网站的支持!
相关文章
猜你喜欢
- 刀片服务器是什么 刀片服务器的主要特点 2025-05-27
- 利用FTP和计划任务自动备份网站数据和数据库 2025-05-27
- 服务器技术之硬件冗余技术 2025-05-27
- 服务器是租用还是服务器托管好? 2025-05-27
- 什么是DNS以及它如何影响服务器? 2025-05-27
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-05-27 27
-
2025-05-25 59
-
DreamHost与BlueHost美国虚拟主机的简单对比评测
2025-05-26 30 -
2025-05-27 109
-
2025-05-27 59
热门评论