I'm getting some strange errors that I've worked through to this point.

I have an Ubuntu server setup with Apache + mod_wsgi + Django. When I'm SSH'd into the server, I can access the website fine from a browser on a different machine, and everything looks splendid. When I'm not SSH'd in, I get a 404 Not Found on my Browser, with this as the error in my Apache logs:

[Wed Apr 18 10:15:02 2012] [error] [client ...] Target WSGI script not found or unable to stat: /home/zen/kiosk

(The thing that bothers me the most about this error, is that the target WSGI script is not the full path I have listed in my apache config file)


  • Ubuntu 10.10 64-bit
  • Apache 2.2.16
  • Python 2.6.6
  • Django 1.3.1
  • mod_wsgi 3.2

Apache Config:

Alias /static/ /home/zen/kiosk/static/

User zen

<Directory /home/zen/kiosk/static>
Order deny,allow
Allow from all

WSGIScriptAlias / /home/zen/kiosk/server/config/django.wsgi
#Alias / /home/zen/kiosk/server/config/django.wsgi

<Directory /home/zen/kiosk/server/config>
Order allow,deny
Allow from all

When Using just Alias instead of WSGIScriptAlias (as commented out in the Config file), I'm able to see the wsgi file if I'm SSH'd in, but get the same 404 I get up above with this as the error message:

[Wed Apr 18 11:10:01 2012] [error] [client ...] File does not exist: /home/zen/kiosk

WSGI Config (/home/zen/kiosk/server/config/django.wsgi)

import os, sys

sys.path.insert(0, '/home/zen/kiosk/server')
sys.path.insert(0, '/home/zen/kiosk')

os.environ['DJANGO_SETTINGS_MODULE'] = 'server.settings'
os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs'
os.environ["CELERY_LOADER"] = "django"

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

sys.stdout = sys.stderr

Everything /home/zen/kiosk and under were chmoded to 755, but that didn't really seem to matter.

drwxr-xr-x 8 zen zen 4096 2012-04-16 16:13 /home/zen
zen@KioskServer:~$ ls -ld /home/zen/kiosk
drwxr-xr-x 8 zen zen 4096 2012-04-11 12:52 /home/zen/kiosk
zen@KioskServer:~$ ls -ld /home/zen/kiosk/server/
drwxr-xr-x 8 zen zen 4096 2012-04-16 15:05 /home/zen/kiosk/server/
zen@KioskServer:~$ ls -ld /home/zen/kiosk/server/config/
drwxr-xr-x 3 zen zen 4096 2012-04-03 22:05 /home/zen/kiosk/server/config/
zen@KioskServer:~$ ls -l /home/zen/kiosk/server/config/django.wsgi
-rwxr-xr-x 1 zen zen 504 2012-04-16 14:44 /home/zen/kiosk/server/config/django.wsgi

When I remove "User zen" from the Apache Config file, I get the following error instead of the Target WSGI script one, as long as I'm not SSH'd into the server.

[Wed Apr 18 10:29:02 2012] [error] [client ...] (13)Permission denied: access to /login/ denied

Where my Browser has a 403 Forbidden error. This error also doesn't occur when I'm SSH'd in.

This feels like some Permissions error, or maybe some issue with some Path variables. Unfortunately, I'm kind of stuck at this point and I'm not sure what else to try.


Edit: I saw on a different thread someone ask for this command (dpkg -l *apache* |grep -E '^ii') so I figured I'd add it now. I used to have prefork but switched to worker when someone suggested it might help. The error was occurring with prefork and in worker exactly the same.

ii  apache2                         2.2.16-1ubuntu3.5                Apache HTTP server metapackage 
ii  apache2-mpm-worker              2.2.16-1ubuntu3.5                Apache HTTP Server - high speed threaded model 
ii  apache2-utils                   2.2.16-1ubuntu3                  utility programs for webservers 
ii  apache2.2-bin                   2.2.16-1ubuntu3.5                Apache HTTP Server common binary files 
ii  apache2.2-common                2.2.16-1ubuntu3.5                Apache HTTP Server common files 
ii  libapache2-mod-wsgi             3.2-2                            Python WSGI adapter module for Apache

Edit2: Looks like this has to do with an Encrypted Home Directory, which I was unaware of I had on this server. I can't post an answer for it yet due to Reputation, but I will when I can so other people with the same issue will be able to figure out the deal much quicker.

1 Answer 1


After two days of searching, I found someone else with the same issue.

Basically, the server was setup with an Encrypted Home Directory (unbeknownst to me), so when I was logged in and testing everything went as expected. But as soon as I wasn't, the home directory was no longer available to Apache.

Hopefully, if anyone else runs across this issue this post will help them out. The quickest way I found to see if you have an Encrypted Home Directory is to run:

$ mount | grep ecryptfs

The process of "unencrypting" your home directory seemed painful, so I resolved this issue by moving my Django directory outside of /home and into /var/www

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.