Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have tested the configuration on a local Gentoo box, but on my Strato-vServer it does not work:

$ apache2 -M|grep wsgi
wsgi_module (shared)

# cat /etc/apache2/sites-enabled/000-default 
<VirtualHost *:80>

    DocumentRoot /var/www/vhosts/default/

    <Directory /var/www/vhosts/default/>
    Options Indexes FollowSymLinks MultiViews ExecCGI

    AddHandler cgi-script .cgi
    AddHandler wsgi-script .wsgi

    SetHandler wsgi-script
    Options ExecCGI

    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ "/var/www/vhosts/default/cgi-bin/"
<Directory "/var/www/vhosts/default/cgi-bin/">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

The wsgi script:

root@h1900160:/var/www/vhosts/default/cgi-bin# cat test.wsgi 
def application(environ, start_response):
    status = "200 OK"
    output = "Hello World!"

    response_headers = [('Content-type', 'text/plain'),
                ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

The script is only shown as plain text. Error log says this:

[Fri May 13 12:54:02 2011] [info] mod_wsgi (pid=14311): Attach interpreter ''.
share|improve this question

Not that it will solve your problem, but you should have the line:

SetHandler wsgi-script

The line:

AddHandler wsgi-script .wsgi

already ensures that anything with .wsgi extension is process by mod_wsgi. Adding SetHandler will only serve to cause you .cgi scripts to no longer be served as CGI scripts. Also, you wouldn't be able to server up static files any more either.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .