gpt4 book ai didi

apache - 禁用 apache 上的目录列表;但应允许访问单个文件

转载 作者:行者123 更新时间:2023-12-03 13:03:30 25 4
gpt4 key购买 nike

我不想使用 .htaccess。我应该如何更改我的目录属性?

<VirtualHost *:80>
ServerName abc.com
DocumentRoot /usr/share/uploads
<Directory " /usr/share/uploads">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

最佳答案

如果您使用的是 Debian/Ubuntu,只需转到终端并输入

sudo a2dismod autoindex
sudo service apache2 restart

如果您使用的是 Centos/Fedora,只需执行以下操作:
mv /etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/autoindex.bkp
/etc/init.d/httpd restart

同样在其他操作系统或发行版中......

这应该禁用使那些花哨(通常无用和安全问题)目录列表的 apache 模块。此外,作为奖励,您可以获得一些表现:-)

关于apache - 禁用 apache 上的目录列表;但应允许访问单个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11136913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com