Apache mod_wsgi error: Forbidden You don't have permission to access / on this server

后端 未结 5 1765
长发绾君心
长发绾君心 2020-12-01 14:35

I\'m using Ubuntu 10.04.
I create a django project under /home/wong2/Code/python/django2/ named atest
and create a wsgi file setting.

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 15:22

    The second directory block doesn't match where you have your WSGI script file installed. It is very bad practice though to stick the WSGI script file in a location where source code or other sensitive files exist, ie., same directory or sub directory. Instead you should stick it in a sub directory of its own. Thus:

    WSGIScriptAlias / /home/wong2/Code/python/django2/atest/apache/setting.wsgi
    
        Order allow,deny
        Allow from all
    
    

    So, create 'apache' subdirectory under 'atest'. Move 'setting.wsgi' into that 'apache' subdirectory and change config to above.

    Your problem also may be caused by restrictive permisions on your home directory as Apache cannot see inside.

    Go watch:

    http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations

    as it explains these permissions problems as well as issues like where to stick your code and the WSGI script file.

    Also read:

    http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

提交回复
热议问题