wsgi not handling request for mapped URI

50 views
Skip to first unread message

rdavies

unread,
Nov 4, 2009, 1:01:39 PM11/4/09
to modwsgi
I'm new to mod_wsgi, but not to web applications or web servers. I've
followed the installations instructions, then created the simple app
described in the quick configuration guide. When I request
http://my.server.com/myapp
the request is not handled by mod_wsgi.

The one complexity is that I also have mod_jk installed, and the last
worker directive handles /*, while the wsgi directive is maps the URI /
testapp . Could this be the problem?

This feels like I'm doing something very basic wrong, but I've been
over the install and config guides several times. Any help would be
appreciated. Thanks in advance.

-Rich

Ubuntu 8.04 LTS on a 64 bit intel

apache and mod-wsgi were installed from Ubuntu packages. Apache is
prefork and I've installed the apache dev package:

% dpkg -l | grep apache
ii apache2 2.2.8-1ubuntu0.11
ii apache2-mpm-prefork 2.2.8-1ubuntu0.11
ii apache2-prefork-dev 2.2.8-1ubuntu0.11
ii apache2-utils 2.2.8-1ubuntu0.11
ii apache2.2-common 2.2.8-1ubuntu0.11
ii libapache2-mod-auth-mysql 4.3.9-4
ii libapache2-mod-jk 1:1.2.25-2
ii libapache2-mod-php5 5.2.4-2ubuntu5.7
ii libapache2-mod-wsgi 1.3-1

Apache start up recognizes wsgi:
[Wed Nov 04 11:36:20 2009] [warn] mod_wsgi: Compiled for Python/2.5.1.
[Wed Nov 04 11:36:20 2009] [warn] mod_wsgi: Runtime using Python/
2.5.2.
[Wed Nov 04 11:36:20 2009] [warn] mod_wsgi: Python module path '/usr/
lib/python25.zip:/usr/lib/python2.5/:/usr/lib/python2.5/plat-linux2:/
usr/lib/python2.5/lib-tk:/usr/lib/python2.5/lib-dynload'.
[Wed Nov 04 11:36:20 2009] [notice] Apache/2.2.8 (Ubuntu) mod_jk/
1.2.25 PHP/5.2.4-2ubuntu5.7 with Suhosin-Patch mod_wsgi/1.3 Python/
2.5.2 configured -- resuming normal operations

Apache config:
NameVirtualHost *
<VirtualHost *>
ServerName my.server.com
ServerAlias my.server.com

WSGIScriptAlias /testapp /usr/local/www/wsgi-scripts/testapp.wsgi

<Directory /usr/local/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>

JkMount /japp1/* japp1worker
JkMount /* jrootworker

DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
#CustomLog "|/usr/local/bin/parselog.pl" "[ %v %{%Y %m %d}t ] %h
%l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\""
ServerSignature On

Alias /doc/ "/usr/share/doc/"
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

Access log:
128.101.35.46 - - [04/Nov/2009:11:36:44 -0600] "GET /testapp HTTP/1.1"
302 - "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.15)
Gecko/2009102814 Ubuntu/8.04 (hardy) Firefox/3.0.15"

The 302, I presume, is coming from the "jrootworker" b/c it redirects
me to the login page for that app.

Clodoaldo Neto

unread,
Nov 4, 2009, 1:41:52 PM11/4/09
to mod...@googlegroups.com
2009/11/4 rdavies <davie...@gmail.com>:
You say you request http://my.server.com/myapp but the alias you
configured is /testapp. Is it correct?

mod_wsgi 1.3 is too old.

Regards, Clodoaldo

rdavies

unread,
Nov 4, 2009, 2:52:52 PM11/4/09
to modwsgi
On Nov 4, 12:41 pm, Clodoaldo Neto <clodoaldo.pi...@gmail.com> wrote:
> You say you requesthttp://my.server.com/myapp but the alias you
> configured is /testapp. Is it correct?

Oops, no. My request was actually to testapp (as can be seen in the
access.log at the bottom of my post).

> mod_wsgi 1.3 is too old.

OK, maybe the Ubuntu package approach was a bad idea. I'll try to
build from source.

Thanks for the reply.
-Rich

rdavies

unread,
Nov 4, 2009, 3:40:35 PM11/4/09
to modwsgi
On Nov 4, 1:52 pm, rdavies <davies.r...@gmail.com> wrote:
> On Nov 4, 12:41 pm, Clodoaldo Neto <clodoaldo.pi...@gmail.com> wrote:
>
> > You say you requesthttp://my.server.com/myappbut the alias you
> > configured is /testapp. Is it correct?
>
> Oops, no.  My request was actually to testapp (as can be seen in the
> access.log at the bottom of my post).
>
> > mod_wsgi 1.3 is too old.
>
> OK, maybe the Ubuntu package approach was a bad idea.  I'll try to
> build from source.

I've built wsgi 2.6 from source using the basic install
instructions...
./configure
make
sudo make install

Upon start up, Apache reports the new version...
"Apache/2.2.8 (Ubuntu) mod_jk/1.2.25 mod_wsgi/2.6 Python/2.5.2 PHP/
5.2.4-2ubuntu5.7 with Suhosin-Patch (internal dummy connection)"

Result is the same...
"GET /testapp HTTP/1.1" 302 - "-" "Mozilla/5.0 ... Firefox/3.0.15"

Graham Dumpleton

unread,
Nov 4, 2009, 4:58:29 PM11/4/09
to mod...@googlegroups.com
Do you really need to have all URLs under slash passed through to
mod_jk. So, instead of:

JkMount /japp1/* japp1worker
JkMount /* jrootworker

can you instead use:

JkMount /japp1/* japp1worker
JkMount /*.jsp jrootworker

That is, be more specific about what it is matching and now allowing
it to wildcard on everything?

Alternatively, just try changing the order of the LoadModule lines in
Apache so that order mod_jk and mod_wsgi are loaded is reversed.

Graham

2009/11/5 rdavies <davie...@gmail.com>:

rdavies

unread,
Nov 4, 2009, 5:30:53 PM11/4/09
to modwsgi
On Nov 4, 2:40 pm, rdavies <davies.r...@gmail.com> wrote:
> On Nov 4, 1:52 pm, rdavies <davies.r...@gmail.com> wrote:
>
> > On Nov 4, 12:41 pm, Clodoaldo Neto <clodoaldo.pi...@gmail.com> wrote:
>
> > > You say you requesthttp://my.server.com/myappbutthe alias you
> > > configured is /testapp. Is it correct?
>
> > Oops, no.  My request was actually to testapp (as can be seen in the
> > access.log at the bottom of my post).
>
> > > mod_wsgi 1.3 is too old.
>
> > OK, maybe the Ubuntu package approach was a bad idea.  I'll try to
> > build from source.
>
> I've built wsgi 2.6 from source using the basic install
> instructions...
> ./configure
> make
> sudo make install
>
> Upon start up, Apache reports the new version...
> "Apache/2.2.8 (Ubuntu) mod_jk/1.2.25 mod_wsgi/2.6 Python/2.5.2 PHP/
> 5.2.4-2ubuntu5.7 with Suhosin-Patch (internal dummy connection)"
>
> Result is the same...
> "GET /testapp HTTP/1.1" 302 - "-" "Mozilla/5.0 ... Firefox/3.0.15"

Just following up with my solution in case someone else comes across
this. I modified the Apache virtual host config, using the JkUnMount
directive (provided by mod_jk) to override the /* URI mapping to my
root Tomcat app...

<VirtualHost *>
...
# recall I had to mod_jk workers, a named app and a root...
JkMount /japp1/* japp1worker
JkMount /* jrootworker

# now override the root worker mapping for specifically named apps
JkUnMount /testapp jrootworker

# ... then map those apps to wsgi
WSGIScriptAlias /testapp /usr/local/www/wsgi-scripts/testapp.wsgi
...
</VirutalHost>

BTW, should this be added to the Configuration Issues wiki page?
(http://code.google.com/p/modwsgi/wiki/ConfigurationIssues)

-Rich

Graham Dumpleton

unread,
Nov 4, 2009, 5:35:50 PM11/4/09
to mod...@googlegroups.com
2009/11/5 rdavies <davie...@gmail.com>:

Thanks for posting the solution.

It is however probably not warranted that it be in the configuration
issues page given that it isn't exactly a commonly occurring problem,
you being only the first person to have the issue. :-)

Graham

Reply all
Reply to author
Forward
0 new messages