小智 34
编辑通常在目录上的apache2配置文件:"/ etc/apache2/httpd .conf".
如果您已经具有默认Web服务器目录(/ var/www)的一些配置,请添加以下内容或进行编辑:
<Directory /var/www>
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
这将禁用对所有公共目录的索引.
AJ.*_*AJ. 19
通常这样做:
Options -Indexes
Run Code Online (Sandbox Code Playgroud)
减号意味着"不"......
如果您a2dismod的发行版上有该实用程序,并且根本不需要目录索引,则可以完全删除该模块:
sudo a2dismod --force autoindex
Run Code Online (Sandbox Code Playgroud)
使用--force或-f标志可以避免出现以下警告:
WARNING: The following essential module will be disabled.
This might result in unexpected behavior and should NOT be done
unless you know exactly what you are doing!
autoindex
To continue type in the phrase 'Yes, do as I say!' or retry by passing '-f': Yes, do as I say!
Module autoindex disabled.
To activate the new configuration, you need to run:
systemctl restart apache2
Run Code Online (Sandbox Code Playgroud)
这是以下文档mod_autoindex
小智 6
须藤纳米 /etc/apache2/apache2.conf
<Directory /var/www/>在文件中找到此部分
向索引添加减号(拒绝)
为 FollowSymLinks 添加一个加号
结果 :
<Directory /var/www/>
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
在 Raspbian 中工作
您将收到消息:“您无权访问此服务器上的“目录”。”
| 归档时间: |
|
| 查看次数: |
42404 次 |
| 最近记录: |