Application of DirectoryIndex to an Alias in Apache

我只是一个虾纸丫 提交于 2019-12-11 03:21:55

问题


How does one apply DirectoryIndex to an Alias in Apache without resulting in error 403?

This results in response header 200:

http://localhost/ Which presents 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>

This results in error 403, forbidden:

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 reveals same message seen in the browser.

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

回答1:


DirectoryIndex to an Alias should be in pirticular directive for that alias in apache2

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


来源:https://stackoverflow.com/questions/15756921/application-of-directoryindex-to-an-alias-in-apache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!