2013-04-02 18 views
2

如何將DirectoryIndex應用於Apache中的別名而不會導致錯誤403?將DirectoryIndex應用於Apache中的別名

這導致響應頭200:

http://localhost/呈現 http://localhost/index.html

<VirtualHost *:80> 
    ServerAdmin [email protected] 

    DocumentRoot /var/www 
    DirectoryIndex index.html index.php index.xhtml index.htm default.htm 
    <Directory /> 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 
    <Directory /var/www/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride None 
      Order allow,deny 
      allow from all 
    </Directory> 

這導致錯誤403,禁止:

http://localhost/aliasName/wwwrootDevelopmentSubDirectory/

<VirtualHost *:80> 
    ServerAdmin [email protected] 

    DocumentRoot /var/www 
    DirectoryIndex index.html index.php index.xhtml index.htm default.htm 
    <Directory /> 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 
    <Directory /var/www/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride None 
      Order allow,deny 
      allow from all 
    </Directory> 

    Alias /aliasName/ "/home/user/Dropbox/Level1/Level2/wwwrootDevelopment/" 
    <Directory /home/user/Dropbox/Level1/Level2/wwwrootDevelopment> 
      DirectoryIndex index.html index.php index.xhtml index.htm default.htm 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride None 
      Order allow,deny 
      Allow from all 
    </Directory> 

error.log中揭示了在瀏覽器中看到的相同的消息。

[Tue Apr 02 00:19:30 2013] [error] [client 172.x.x.x] (13)Permission denied: access to /aliasName/wwwrootDevelopmentSubDirectory/ denied, referer: http://localhost/ 

回答

0

DirectoryIndex的一個別名應該在pirticular指令爲別名的Apache2

Alias /pma "/var/www/pma" 
<Directory "/var/www/pma"> 
    DirectoryIndex adminer.php 
    Options Indexes FollowSymLinks 
    AllowOverride All 
    Require all granted 
</Directory>