簡體   English   中英

DirectoryIndex在Apache別名中的應用

[英]Application of DirectoryIndex to an Alias in Apache

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

結果是響應頭200:

http://localhost/ http://localhost/index.html

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    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 webmaster@localhost

    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/

別名的DirectoryIndex應該在apache2中該別名的主要指令中

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM