Changeset - e6c7d225cac3
[Not reviewed]
stable
0 1 0
Mads Kiilerich (mads) - 18 months ago 2024-09-23 01:30:00
mads@kiilerich.com
Grafted from: 106377f65216
docs: Make mod_wsgi description more clear and actionable
1 file changed with 11 insertions and 5 deletions:
0 comments (0 inline, 0 general)
docs/setup.rst
Show inline comments
 
@@ -622,60 +622,66 @@ that, you'll need to:
 
    aptitude install libapache2-mod-wsgi
 

	
 
- Enable mod_wsgi::
 

	
 
    a2enmod wsgi
 

	
 
- Add global Apache configuration to tell mod_wsgi that Python only will be
 
  used in the WSGI processes and shouldn't be initialized in the Apache
 
  processes::
 

	
 
    WSGIRestrictEmbedded On
 

	
 
- Create a WSGI dispatch script, like the one below. The ``WSGIDaemonProcess``
 
  ``python-home`` directive will make sure it uses the right Python Virtual
 
  Environment and that paste thus can pick up the right Kallithea
 
  application.
 
- Create a WSGI dispatch script, like `/srv/kallithea/wsgi.py`:
 

	
 
  .. code-block:: python
 

	
 
      ini = '/srv/kallithea/my.ini'
 
      from logging.config import fileConfig
 
      fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'})
 
      from paste.deploy import loadapp
 
      application = loadapp('config:' + ini)
 

	
 
  We will use the ``WSGIDaemonProcess`` directive ``python-home`` to make sure
 
  it uses the right Python Virtual Environment where paste loadapp will pick up
 
  the right Kallithea application.
 

	
 
- Add the necessary ``WSGI*`` directives to the Apache Virtual Host configuration
 
  file, like in the example below. Notice that the WSGI dispatch script created
 
  above is referred to with the ``WSGIScriptAlias`` directive.
 
  The default locale settings Apache provides for web services are often not
 
  adequate, with `C` as the default language and `ASCII` as the encoding.
 
  Instead, use the ``lang`` parameter of ``WSGIDaemonProcess`` to specify a
 
  suitable locale. See also the :ref:`overview` section and the
 
  `WSGIDaemonProcess documentation`_.
 

	
 
  Apache will by default run as a special Apache user, on Linux systems
 
  usually ``www-data`` or ``apache``. If you need to have the repositories
 
  directory owned by a different user, use the user and group options to
 
  WSGIDaemonProcess to set the name of the user and group.
 

	
 
  Once again, check that all paths are correctly specified.
 

	
 
  .. code-block:: apache
 

	
 
      WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 \
 
          python-home=/srv/kallithea/venv lang=C.UTF-8
 
      WSGIProcessGroup kallithea
 
      WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
 
      WSGIScriptAlias / /srv/kallithea/wsgi.py
 
      WSGIPassAuthorization On
 
      <Directory /srv/kallithea>
 
          <Files wsgi.py>
 
              Require all granted
 
          </Files>
 
      </Directory>
 

	
 

	
 
Other configuration files
 
-------------------------
 

	
 
A number of `example init.d scripts`__ can be found in
 
the ``init.d`` directory of the Kallithea source.
 

	
 
.. __: https://kallithea-scm.org/repos/kallithea/files/tip/init.d/ .
 

	
 

	
 
.. _python: http://www.python.org/
0 comments (0 inline, 0 general)