为什么我们需要<;目录>;在Apache.conf文件中?

为什么我们需要<;目录>;在Apache.conf文件中?,apache,config,Apache,Config,简单问题: <VirtualHost *:80> ServerName notes.example.com DocumentRoot /var/www/notes <Directory "/var/www/notes"> Require all granted Options +Indexes </Directory> </VirtualHost> ServerName note

简单问题:

<VirtualHost *:80>
    ServerName notes.example.com
    DocumentRoot /var/www/notes

    <Directory "/var/www/notes">
        Require all granted
        Options +Indexes
    </Directory>
</VirtualHost>

ServerName notes.example.com
DocumentRoot/var/www/notes
要求所有授权
选项+索引
乍一看,这就像放:

<VirtualHost *:80>
    ServerName notes.example.com
    DocumentRoot /var/www/notes
</VirtualHost>

ServerName notes.example.com
DocumentRoot/var/www/notes
那么,我们为什么需要这个
语句呢


我在网上找到了几个例子,其中一些人在使用
东西,另一些人只是把他们的设置放在
分支下。

因为你可以为特定的目录定义特定的参数

你可以

<Directory "/var/www/notes/private">
   Options -Indexes
<Directory>

选项-索引
或者类似的东西
DocumentRoot
将自行工作,但如果要添加目录选项,则需要使用目录标记