阿帕奇“您没有权限访问此服务器上的XX' [英] Apache 'You don't have permission to access xx on this server'

查看:769
本文介绍了阿帕奇“您没有权限访问此服务器上的XX'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Ubuntu 12.04和Apache(以两者中新),我想添加一个新的虚拟目录,所以我修改文件的/ etc / apache2的/网站的可用/默认,加入以下内容:

I am using ubuntu 12.04 and apache (new in both of them) and I want to add a new virtual directory so I modify the file /etc/apache2/sites-available/default, adding the following:

Alias /docs/ "/home/kk/workspace/javascript/maplib/"
<Directory "/home/kk/workspace/javascript/maplib/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
</Directory>

然后我打开网址的http://本地主机/文档/ 在浏览器中,我得到以下信息:

Then I open the url http://localhost/docs/ in the browser and I get the following message:

You don't have permission to access /docs/ on this server.

那么我认为这可能对文件/文件夹的权限引起的。所以我添加了 permession到所有用户:

Then I think it may be caused by the file/folder permission. So I add the read permession to all users by:

sudo chmod a+r /home/kk/workspace/javascript/maplib/

然后我跑

ls -ld ~/workspace/javascript/maplib/ 

和我得到这个:

drwxr--r-- 14 kk kk 4096 Mar 11 08:36 /home/kk/workspace/javascript/maplib/

正如你可以看到每一个用户shold有进入该目录,但没有改变(我也得到了 403 消息)。

As you can see every user shold have the read access to the directory, but nothing changed ( I also get the 403 message).

然后我试图找到 /无功/网络的许可,我得到:

Then I try to find the permission of /var/www and I get:

drwxr-xr-x 2 root root 4096 Mar  8 15:33 /var/www

看来,它只是添加执行权限的文件夹,但我不认为这是问题。

It seems that it just add the execute permission to the folder, but I do not think this is the problem.

这是怎么回事呢?

顺便说一句,为什么阿帕奇识别 /文档 /文档/ 与两个不同的网址?因为我会得到 404 本地主机/文档

BTW, why does apache identify /docs and /docs/ with two different url? Since I will get 404 by localhost/docs?

推荐答案

在Apache安装的访问控制使用等/的Apache2 / envars和实施等/ apache2的/ apache2.conf

In your Apache installation access is controlled using etc/apache2/envars and implemented in etc/apache2/apache2.conf

在/etc/apache2/apache2.conf中,你会发现大约下降一半如下的文件。

In /etc/apache2/apache2.conf you will find the following lines about half way down a the file.

#These need to be set in /etc/apache2/envars
    User ${APACHE_RUN_USER}
    Group ${APACHE_RUN_GROUP}

在/ etc / apache2的/ envars你会发现

In /etc/apache2/envars you will find

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data 

您想要的Web服务器访问的目录需要运行Web服务器在一组。我想说检查组的权限,并在必要时进行修复。如果您有这些正确设置回来后Apache的访问日志。

The directories you want the webserver to access need to be in the group running the webserver. I would say to check the group permissions and fix them if necessary. If you have these set correctly come back and post the Apache access logs.

这篇关于阿帕奇“您没有权限访问此服务器上的XX'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆