Following this guide:
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
I was not able to configure a “Hello World” WSGI application (I did not mount at docroot and did not delegate to daemon)
on my ubuntu squeeze. Python version is 2.6.5.
I believe mod_wsgi is installed correctly.
Here is what I did:
- Created a user /home/wsgitest (I know we are not supposed to do this but it’s just for testing).
-
Added the user to group www-data, which is what apache2 runs under:
groups wsgitest wsgitest : wsgitest www-dataAs wsgitest, added permissions to read the folder explicitly:
chmod -R g+rx wsgitest -
Created a WSGI Application Script File with the exact same contents from the guide:
ls -la /home/wsgitest/ (...) -rw-r--r-- 1 wsgitest wsgitest 277 May 7 17:11 application.wsgi -
Created an application config file:
cat /etc/apache2/sites-available/application.conf <VirtualHost *:80> WSGIScriptAlias /application /home/wsgitest/application.wsgi <Directory /home/wsgitest> Order allow,deny Allow from all </Directory> </VirtualHost>
(File belongs to root:root)
-
Enabled the site:
ls -la /etc/apache2/sites-enabled/ (..) lrwxrwxrwx 1 root root 35 May 9 15:29 application.conf -> ../sites-available/application.conf -
Restarted apache2 and went to the following address:
<ip-address>/application <ip-address>/application/
which gives 404.
-
Disabled the site and put the follwing at bottom of file /etc/apache2/apache2.conf :
<Directory /home/wsgitest> Order allow,deny Allow from all </Directory> WSGIScriptAlias /application /home/wsgitetst/application.wsgi -
Restarted apache and tried to navigate again, no changes.
-
Tried with lynx and localhost, no changes.
-
Enabled logging info level in apache2. The /var/log/apache2 access log tells me that the request is answered with “404 503”,
And this is from error.log:[Wed May 09 15:39:28 2012] [info] mod_wsgi (pid=27914): Attach interpreter ''. (...) [Wed May 09 15:39:32 2012] [error] [client <ip>] File does not exist: /var/www/application (...) [Wed May 09 15:39:28 2012] [info] mod_wsgi (pid=27914): Cleanup interpreter ''.
The “other_vhosts_access.log” is empty.
To me it looks like the request never reaches the wsgi app or isn’t routed somehow…
Can anyone help me identify the problem?
Oh no. I did check everything 3 or 4 times but still there was a typo in there.
As you can see in the declaration of WSGIScriptAlias from the apache2.conf edit (wsgitetst).
The include config still won’t work, but that’s OK.