Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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