Table of Contents

Apache mod_wsgi

Ubuntu

In Ubuntu, install the module:

aptitude -y install libapache2-mod-wsgi

Apache 2.4

Add an alias for the Python interpreter and set permissions:

WSGIScriptAlias /python /usr/local/www/wsgi-scripts/python.wsgi
<Directory "/usr/local/www/wsgi-scripts">
    Require all granted
</Directory>

Hello world script for python.wsgi:

def application(environ, start_response):
	status = '200 OK'
	output = b'Hello, world!'
	response_headers = [('Content-type', 'text-plain'), ('Content-Length', str(len(output)))]
	start_response(status, response_headers)

	return [output]