2014年1月4日 星期六

Missing mod_wsgi configuration file on openSuse 12.3

I try to install and config mod_wsgi on openSuse 12.3 few week.
Install apache2 and mod_wsgi on yast2. Finally, it work with below config file.

/etc/apache2/conf.d/wsgi.conf
----------
WSGIScriptAlias /wsgi /srv/www/htdocs/wsgi.py
WSGIPythonPath /srv/www/wsgi
WSGIPythonOptimize 1
WSGIPythonHome /usr
WSGIPythonHome /usr/lib64/python2.7/
WSGIDaemonProcess wsgi processes=4 threads=12 inactivity-timeout=300 deadlock-timeout=30 shutdown-timeout=30 displ$

<IfModule mod_wsgi.c>
       <FilesMatch "\.py$">
        #SetHandler text/x-python
        SetHandler wsgi-script
        Options +ExecCGI
       </FilesMatch>
       <FilesMatch "\.py[co]$">
           SetHandler application/x-python-bytecode
       </FilesMatch>
        DirectoryIndex index.py
        DirectoryIndex index.pyc
        DirectoryIndex index.pyo
</IfModule>
----------

The test page
/srv/www/htdocs/wsgi.py
----------
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]
----------

# Modify "WSGIScriptAlias /wsgi /srv/www/htdocs/wsgi.py" that you want
go to http://127.0.0.1/wsgi



沒有留言:

張貼留言