Alias 403 Forbidden with Apache

≡放荡痞女 提交于 2019-12-04 09:57:41

问题


I'm trying to create a folder named week7 and an html page named hello.html in that folder outside the document root and have it viewed through an Alias directive.

I created a folder named week7 out of the Document Root. I chose this location for it:

/usr/local/www/week7

while my document root is:

/usr/local/www/apache22/data

in httpd.conf and under tag, I wrote:

    Alias /week7 /usr/local/www/week7
<Directory /usr/local/www/week7>
    Require all granted
</Directory>

After rebooting the server, I got the following message: Forbidden 403 message.

I tried changing permissions for the hello.html file, the week7 folder and even the www folder and nothing changed.

Any ideas?


回答1:


If you're using apache 2.4

Order allow,deny
Allow from all

becomes...

Require all granted

https://httpd.apache.org/docs/2.4/upgrading.html




回答2:


I know it's old but just for the record, the following worked for me in XAMPP (Windows 8)

Alias /projects c:/projects

<Directory c:/projects>
    Options Indexes FollowSymLinks MultiViews
    Order allow,deny
    Allow from all
</Directory>

EDIT

On XAMPP 5.6 and Apache 2.4 try this:

Alias /projects c:/projects

<Directory c:/projects >
    Options Indexes FollowSymLinks MultiViews
    Require all granted
</Directory>



回答3:


I fixed this issue with these directives:

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local

You'll only be able to browse from your local computer, but it works for local testing and development.




回答4:


After i configured all above guides it does not work for me

Cause i'm using linux mint

... Finally i found the other case for linux users "starting apache correct user"

After reading IfModule unixd_module Notes

I changed the user and group to owner of alias directory or root user then the error 403 had gone.

/opt/lampp/etc/httpd.conf

<IfModule unixd_module>
User mrJohn
Group mrJohn
</IfModule>

Hope it useful.




回答5:


Alias /data /media/pi/VOLUME

.....

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Require local

works fine on Raspbian for localhost




回答6:


For me worked this solution:

When I access the virtual directory an error “Access forbidden! Error 403” occured.
The config seems to ok:

Alias /static/ /home/username/sites/myblog/static/
<Directory /home/username/sites/myblog/static> Options Indexes FollowSymLinks MultiViews ExecCGI AllowOverride All Order allow,deny Allow from all </Directory>
Solution: The default apache configration is very restrictive. It do not allow to access directories without authentication. This is defined in the Directory section of httpd.conf: <Directory> AllowOverride none Require all denied </Directory>
Add a “require all granted” directive to your virtual directory section will grant the access.

Alias /static/ /home/username/sites/myblog/static/ <Directory /home/username/sites/myblog/static> AllowOverride All Order allow,deny Allow from all Require all granted </Directory>



来源:https://stackoverflow.com/questions/11215283/alias-403-forbidden-with-apache

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