Forbidden(Server error)

Avi lists at avi.co
Wed Jul 20 17:57:38 UTC 2011


Amrit Pal Pathak wrote:

> You don't have permission to access /directory/ on this server.
> ------------------------------
> Apache/2.2.14 (Ubuntu) Server at localhost Port 80
> 
> I have just copied that directory to /var/www.
> What might be wrong.

Well, as suggested by the error you're not permitted to view the file.

There are two sorts of permissions that can cause this - it'll be one
or both of filesystem permissions and Apache permissions.

The filesystem permissions are relatively easy - you just need to check
that the www-data user is permitted to enter the directory and read the
files. You can test this directly by su-ing to www-data and trying to
read the file. Better would be to ls -l and check whether the
permissions are set such that www-data is permitted to enter the
directory and execute the file. It's worth remembering that 'execute'
rights on a directory are actually rights to list its contents.

Apache ones can be somewhat more complicated. In general, though, if
access to the parent directory is permitted, and you've just created
this directory, you're probably allowed in. If you're just getting
started with Apache, this sort of thing is likely to keep tripping you
up for a while, I'm afraid - there are many places and different ways
in which you can deny access to something, and however you do it Apache
logs exactly the same string, which is a bit unhelpful.

It's probably worth reading through the Apache docs on authorisation[0]
but it's really something you just need to get some experience with
before it's a thing to debug quickly.


[0] http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html

-- 
Avi




More information about the ubuntu-users mailing list