我在CentOS 7中安装了Apache 2.4.6。我使用虚拟主机为服务器中的多个域提供服务,并且它们都在/ www中 ,因此:
我在httpd.conf中为这些目录设置了这个目录configuration:
<Directory "/www/example1/html"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <Directory "/www/example2/html"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
由于需要包含更多的域,所以我想把所有的指令都join到一个域中,所以我尝试了这个:
<Directory "/www"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
但是当我这样做的时候,我试图访问example1.com/test.php (注意test.php位于/www/example1/html/test.php ),我得到了这个apache错误:
禁止您无权访问此服务器上的/test.php。
我错过了什么吗? 为了将相同的规则应用于/ www的所有子目录,应如何configuration该configuration?
顺便说一下,这些是httpd.conf中唯一的其他指令
<Directory /> AllowOverride none Require all denied </Directory> <Directory "/var/www"> AllowOverride None Require all granted </Directory> <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>