1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
Apache and mod_wsgi
===================
If you are using the `Apache`__ webserver, you can use it to run Supysonic with
the help of `mod_wsgi`__.
__ https://httpd.apache.org/
__ https://github.com/GrahamDumpleton/mod_wsgi
Installing `mod_wsgi`
---------------------
If you don't have `mod_wsgi` installed yet you have to install it and enable it
first as follows::
# apt install libapache2-mod-wsgi-py3
# a2enmod wsgi
Creating a `.wsgi` file
-----------------------
To run Supysonic within Apache you need a :file:`supysonic.wsgi` file. Create
one somewhere and fill it with the following content:
.. code-block:: python3
from supysonic.web import create_application
application = create_application()
Store that file somewhere that you will find it again (e.g.:
:file:`/var/www/supysonic/supysonic.wsgi`).
Configuring Apache
------------------
The last thing you have to do is to edit the Apache configuration to tell it to
load the application. Here's a basic example of what it looks like:
.. code-block:: apache
WSGIScriptAlias /supysonic /var/www/supysonic/supysonic.wsgi
<Directory /var/www/supysonic>
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
Require all granted
</Directory>
With that kind of configuration, the server address will look like
`http://server/supysonic/`.
For more information consult the `mod_wsgi documentation`__. Note that the
``WSGIPassAuthorization`` directive is required for some clients as they provide
their credentials using the *basic access authentification* mechanism rather
than as URL query parameters.
__ https://modwsgi.readthedocs.io/en/latest/
|