I get this problem when I visit my domain.com. I have compared this with my other website with the SAME set-up (just different username!!!) For some reason that website works and this one doesn't.

Forbidden
You don't have permission to access / on this server.
Apache/2.2.3 (Red Hat) Server at www.mydomain.com Port 80

In terms of permission issues, I have added user "apache" to the group "dver" and "svn" that own the folders that everything is located on.

$ ls -l
total 4
drwxr-xr-x 4 dver svn 4096 Oct 13 19:49 tv

This is my django.wsgi:

import os
import sys
sys.path.append('/home/dver/tv')
os.environ['PYTHON_EGG_CACHE'] = '/home/dver'
os.environ['DJANGO_SETTINGS_MODULE'] = 'mtv.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

This is in my httpd.conf:

WSGIScriptAlias / /home/dver/tv/mtv/wsgi/django.wsgi
DocumentRoot "/home/dver/tv/mtv/"
Alias /media/ /home/dver/tv/mtv/media/
<Directory /home/dver/tv/mtv/media>
Order deny,allow
Allow from all
</Directory>

<Directory /home/dver/tv/mtv>
Order deny,allow
Allow from all
</Directory>

If anyone can help me I'll really appreciate it.

Thanks!

Comments

What are the permissions of the /home/dver directory?

Written by Andre Miller

Hi Andre: ~]$ ls -l total 4 drwxr-xr-x 4 dver svn 4096 Oct 13 19:49

Written by TIMEX

Accepted Answer

As the code will run as the Apache user, all directories from the root of the file system down to '/home/dver/tv/mtv/wsgi' must be readable/executable to others, or at least somehow the Apache user, not just your Django site directory.

Thus, if '/home/dver' has permissions 'rwxr-x---' then it will not work. This is the most common problem where people go and stick the WSGI script file under their own home account. Manipulating groups may work, but you don't indicate if that group ownership also applies to '/home/dver'.

Although it will not matter as refers to a parent directory, but more secure to have:

<Directory /home/dver/tv/mtv/wsgi>
Order deny,allow
Allow from all
</Directory>

That is, use '/home/dver/tv/mtv/wsgi' rather than '/home/dver/tv/mtv'.

One other possibility is that you have SELinux extensions enabled for operating systems. You should configure SELinux correctly if it is, or possibly disable it just to see if it then works.

Written by Graham Dumpleton
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki