默认情况下,在 httpd.conf 你的整个系统目录“/”是安全的,不允许访问
在 httpd.conf 中:
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
在上面添加下面的附加内容
<Directory /home>
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
将 /home 更改为您托管的安装公共目录 - 例如 /projects 或 /devsite.local 等...
有关 Apache 的更多信息,请参见此处:https ://httpd.apache.org/docs/current/mod/core.html#directory
“选项”是典型的 .htaccess 指令 - 根据需要更改
“AllowOverride All”允许访问 /home 文件夹及其下的所有内容
“需要本地”确保只有 localhost / 127.0.0.1 可以访问 /home 下的文件夹和文件
希望这会有所帮助:D