![为什么 Ubuntu 中 Apache 的默认站点有“”吗?](https://linux22.com/image/1041097/%E4%B8%BA%E4%BB%80%E4%B9%88%20Ubuntu%20%E4%B8%AD%20Apache%20%E7%9A%84%E9%BB%98%E8%AE%A4%E7%AB%99%E7%82%B9%E6%9C%89%E2%80%9C%E2%80%9D%E5%90%97%EF%BC%9F.png)
这些是 /etc/apache2/sites-available/default 的内容
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
下面的块是做什么用的?
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
答案1
该块适用于根目录或/
目录。请记住语法是<Directory /path/to/files>
。在您的示例中,路径是/
。
这意味着其下的任何目录/
都会有规则:Options FollowSymlinks
除非AllowOverride None
有针对特定目录覆盖该规则的规则。
要了解这些指令的含义,请查看Apache 指令索引