简体   繁体   English

如何在 WAMP Server 3 的虚拟主机中启用目录列表

[英]How to enable directory listing in a virtual host of WAMP Server 3

I am using wamp server 3 in my local machine.我在本地机器上使用wamp server 3 Whenever I make a virtual host I have to provide at least one index.php file to access my project directory, without it I am getting an 404 error.每当我创建一个虚拟主机时,我必须至少提供一个index.php文件来访问我的项目目录,如果没有它,我会收到404错误。

But I also want to access my project directory without providing the index file.但我也想在不提供index文件的情况下访问我的项目目录。 I like to see the directory lists when server doesn't find an index file.当服务器找不到索引文件时,我喜欢查看目录列表。 Like the below image:像下图:

在此处输入图片说明

I think the issue is in my httpd-vhost.conf file.我认为问题出在我的httpd-vhost.conf文件中。 Here is the virtual-host configuration of the directory that I want to enable directory listing:这是我要启用目录列表的目录的虚拟主机配置:

<VirtualHost *:80>
    ServerName virtualhost.info
    DocumentRoot c:/wamp64/www/virtual_host_test
    <Directory  "c:/wamp64/www/virtual_host_test/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Any help would be greatly appreciated.任何帮助将不胜感激。

Found one solution.找到了一种解决方案。

By default New Wamp disable the Fancy directory listings.默认情况下,New Wamp 禁用 Fancy 目录列表。

Edit the C:\\wamp64\\bin\\apache\\apache2.4.17\\conf\\httpd.conf编辑 C:\\wamp64\\bin\\apache\\apache2.4.17\\conf\\httpd.conf

Need to load this module (remove the #)需要加载这个模块(去掉#)

LoadModule autoindex_module modules/mod_autoindex.so

Need to load this conf (remove the #)需要加载这个配置(删除#)

Include conf/extra/httpd-autoindex.conf

Reference links: WAMP is not displaying the icons in the directory listing参考链接: WAMP 不显示目录列表中的图标

Thanks谢谢

Try this...试试这个...

<VirtualHost *:80>
  ServerName virtualhost.info
  DocumentRoot c:/wamp64/www/virtual_host_test
  <Directory  "c:/wamp64/www/virtual_host_test/">
    Options +Indexes +FollowSymLinks +MultiView
      AllowOverride All
      Require local
   </Directory>
</VirtualHost>

Note the + at the start of the Indexes option.请注意Indexes选项开头的+ You should also read up on this.你也应该仔细阅读这一点。

https://wiki.apache.org/httpd/DirectoryListings https://wiki.apache.org/httpd/DirectoryListings

If you want to enable directory browsing simply you need to do this under the VirtualHost如果您只想启用目录浏览,您需要在VirtualHost下执行此操作

Options +Indexes +FollowSymLinks +MultiViews
#Options -Indexes

and for disabling this feature you just reverse :禁用此功能,您只需反转:

#Options +Indexes +FollowSymLinks +MultiViews
 Options -Indexes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM