mod_wsgi is an Apache module which “can host any Python application which supports the Python WSGI interface”. Litespeed has no lsapi-wsgi yet at the time being(lsws 4.0.12), however, if an Python app running under apache with mod_wsgi, it can run under litespeed too through wsgi-ajp.

the "Hello world" app


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]

Apache configuration

mod_wgsi configuration in Apache httpd_conf:

LoadModule wsgi_module modules/
WSGIScriptAlias /hello /home/python_app/

access url:

run the app in litespeed

1.install ajp-wsgi

2. startup ajp-wsgi

run ajp-wsgi in background:

/home/python_app>ajp-wsgi -v -B -l ajp.log hello application /hello2

or run in foreground:

/home/python_app>ajp-wsgi -v hello application /hello2

above hello refer to /home/python_app/

/hello2 refer url:

3.under Server or vhost, define a "Servlet Engine" External App

when under Server, it's lsws admin console-->Server-->External App-->Add

Servlet Engine Definition example:

Max Connections:200
Connection Keepalive Timeout:30
Initial Request Timeout (secs):20
Retry Timeout (secs):0
Response Buffering:No

4.under a vhost, define a Servlet context

Example of Servlet Context Definition:

Servlet Engine:[Server Level]: ajp

access url:

litespeed_wiki/other-ext-apps/python-apache-mod_wsgi.txt · Last modified: 2015/07/29 15:03 by Michael Alegre