Skip to content

Commit

Permalink
Merge pull request #333 from gstrauss/master
Browse files Browse the repository at this point in the history
lighttpd 1.4.42+ mod_scgi supports uwsgi protocol
  • Loading branch information
xrmx committed Oct 16, 2016
2 parents 4685f59 + 40cb793 commit b602b59
Showing 1 changed file with 10 additions and 44 deletions.
54 changes: 10 additions & 44 deletions Lighttpd.rst
Original file line number Diff line number Diff line change
@@ -1,57 +1,23 @@
Lighttpd support
================

.. note:: Lighttpd support is experimental.

The uwsgi handler for Lighttpd lives in the ``/lighttpd`` directory of the
uWSGI distribution.

Building the module
-------------------

First download the source of lighttpd and uncompress it. Copy the
``lighttpd/mod_uwsgi.c`` file from the uWSGI distribution into Lighttpd's
``/src`` directory. Add the following to the lighttpd ``src/Makefile.am``
file, after the accesslog block:

::

lib_LTLIBRARIES += mod_uwsgi.la
mod_uwsgi_la_SOURCES = mod_uwsgi.c
mod_uwsgi_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
mod_uwsgi_la_LIBADD = $(common_libadd)

Then launch

::

autoreconf -fi

and as usual,

::

./configure && make && make install
lighttpd >= 1.4.42 supports the uwsgi protocol with Python WSGI backends.
The uwsgi protocol is similar to the SCGI protocol, and lighttpd supports
both protocols in mod_scgi.

Configuring Lighttpd
--------------------

Modify your configuration file:
Modify your lighttpd.conf configuration file:

::
server.modules = (
...
"mod_uwsgi",
...
)

# ...

uwsgi.server = (
"/pippo" => (( "host" => "192.168.173.15", "port" => 3033 )),
server.modules += ( "mod_scgi" )
scgi.protocol = "uwsgi"
scgi.server = (
"/" => (( "host" => "127.0.0.1", "port" => 3031 )),
)

If you specify multiple hosts under the same virtual path/URI, load balancing
will be activated with the "Fair" algorithm.
Further doc on configuring lighttpd and Python WSGI can be found at
https://redmine.lighttpd.net/projects/lighttpd/wiki/HowToPythonWSGI
including examples configuring uWSGI servers.

0 comments on commit b602b59

Please sign in to comment.