On May 10, 7:25 pm, Tom Evans <tevans...@gmail.com> wrote:
> On Mon, May 10, 2010 at 9:39 AM, Ivan Uemlianin <i...@llaisdy.com> wrote:
> > Dear Kenneth
>
> > Thanks for your suggestion.
>
> > I tried
>
> >    $ chmod -R a+x mysite
>
> > (where mysite is the django site directory)
>
> > and stopped and started apache, but no effect.
>
> > I'm finding nginx a lot easier to work with than apache, especially
> > CentOS' apache.  My plan now is to get rid of apache altogether and
> > have nginx talk to django directly via fastcgi (e.g., [1]) (will also
> > give me an excuse to try out git instead of svn).  If you don't hear
> > back from me in a day or two, it worked.
>
> > With thanks and best wishes
>
> > Ivan
>
> > [1]  http://code.djangoproject.com/wiki/ServerArrangements#nginx
>
> Good luck with setting up your pure nginx configuration. Your apache
> configuration did not work because you had not granted apache access
> to the required on disk folders.
>
> You didn't mention this in your configuration, but you must allow
> access to your DocumentRoot in your vhost:

No, that isn't it.

The relevant code in Apache that generates the error message is:

            rv = apr_stat(&thisinfo, r->filename,
                          APR_FINFO_MIN | APR_FINFO_NAME |
APR_FINFO_LINK,
                          r->pool);

            if (APR_STATUS_IS_ENOENT(rv)) {
                /* Nothing?  That could be nice.  But our directory
                 * walk is done.
                 */
                thisinfo.filetype = APR_NOFILE;
                break;
            }
            else if (APR_STATUS_IS_EACCES(rv)) {
                ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                              "access to %s denied", r->uri);
                return r->status = HTTP_FORBIDDEN;
            }

Thus, what it is checking is not the Allow/Deny state of the URL
matched as you imply, but the file system access of r->filename, which
is the actual file based resource the URL matched to.

This presumably may have been '/path/to/django/app/apache/
django_wsgi.py', but hard to know as cant even be sure that that part
of the configuration was even used. For all we know the VirtualHost's
were set up properly and could have been matching a wrong VirtualHost.

Anyway, on the mod_wsgi list where they asked this previously they
were given two suggestions.

The first response was that this was often caused by SELinux being
enabled, but they are adamant it isn't, yet haven't provided anything
from Apache error logs in the way of the Apache startup messages which
would help validate that or not.

The second response given to them was """But are all the directories
from that point all the way back up to root file system also readable/
searchable to Apache user."""

They never replied on the mod_wsgi list about this so gave up
assisting them. Their posts here show they didn't act on that comment
or understand it as they have only bothered to ensure permissions of
the site directory were okay and not all directories back up to the
root directory of the whole disk were also accessible as they were
told to ensure.

Anyway, this issue is partly covered in:

  
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User

In short, if the Apache user cannot access all directories from the
root of the file system down to where the WSGI script file is stored
you will get errors like this.

Graham

> <VirtualHost *:80>
>   ServerName foo
>   DocumentRoot /path/to/foo/htdocs
>   <Directory /path/to/foo/htdocs>
>     Order allow,deny
>     Allow from all
>   </Directory>
>   WSGIScriptAlias /app/ /path/to/foo/run/app.wsgi
> </VirtualHost>
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to