0

Hi I need help in integrating django with apache and mod_wsgi on centos6. I am getting following error every time---"Forbidden You don't have permission to access / on this server." My django project path= /home/mchauras/esapp/eswebsite my apache version is 2.2.15 my .conf file looks like this----

<VirtualHost *:80>
    DocumentRoot /home/mchauras/esapp/eswebsite/
    Alias /static /home/mchauras/esapp/eswebsite/esapp/static
    <Directory /home/mchauras/esapp/eswebsite/esapp/static>
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride None
        Order deny,allow
        Allow from all
    </Directory>

    <Directory /home/mchauras/esapp/eswebsite/eswebsite>
        <Files wsgi.py>
            Options Indexes FollowSymLinks Includes ExecCGI
            AllowOverride None
            Order deny,allow
            Allow from all
        </Files>
    </Directory>

    WSGIDaemonProcess esapp python-path=/home/user/myproject:/home/mchauras/esapp/eswebsite/myvenv/lib/python3.5/site-packages/
    WSGIProcessGroup esapp
    WSGIScriptAlias / /home/mchauras/esapp/eswebsite/eswebsite/wsgi.py
    ErrorLog /home/mchauras/esapp/eswebsite/error.log
    CustomLog /home/mchauras/esapp/eswebsite/access.log combined
</VirtualHost>

my wsgi.py file is like this---

import os
import sys
from django.core.wsgi import get_wsgi_application
sys.path.append('/home/mchauras/esapp/eswebsite')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eswebsite.settings")

application = get_wsgi_application()
Mahesh Chaurasia
  • 133
  • 1
  • 1
  • 10

2 Answers2

0

its looks like you did not login as a administrator user or maybe you need to changes and enable all file permission in the path

Evinn
  • 153
  • 1
  • 11
  • I have given 755 permission to all files. – Mahesh Chaurasia Jul 28 '16 at 10:12
  • did you changes file permission using ftp ?? i think you should test to access some file first in root path , maybe some file in subfolder did not get readable file permissions – Evinn Jul 28 '16 at 10:19
  • I changed the file permission using chmod command inside project path. I am sudo user so I am able to access / path. – Mahesh Chaurasia Jul 28 '16 at 10:26
  • you should try that , try this link : http://stackoverflow.com/questions/4807176/apache-mod-wsgi-error-forbidden-you-dont-have-permission-to-access-on-this-s – Evinn Jul 28 '16 at 10:47
0

This specific error is usually always caused by the user that Apache runs as not being able to access the WSGI script file. It is not enough to just make the file itself readable to others. All the directories from '/' down to that directory must also be accessible to the user Apache runs as. As home directories for users are not usually readable by others, the Apache user cannot see into it. You are better off moving the application directory outside of your home directory.

Another possible cause, although one which usually results in a slightly different error, is having SELinux enabled where the profile for Apache httpd server on SELinux doesn't allow access to the directories where your application is.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134