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.
/home/python_app>cat hello.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]
mod_wgsi configuration in Apache httpd_conf:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /hello /home/python_app/hello.py
access url: yourdomain.com/hello
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/hello.py
/hello2 refer url: yourdomain.com/hello2
when under Server, it’s lsws admin console–>Server–>External App–>Add
Servlet Engine Definition example:
Name:ajp
Address:127.0.0.1:8009
Max Connections:200
Connection Keepalive Timeout:30
Initial Request Timeout (secs):20
Retry Timeout (secs):0
Response Buffering:No
Example of Servlet Context Definition:
URI:/hello2
Servlet Engine:[Server Level]: ajp
access url: yourdomain.com/hello2