nilmdb/docs/wsgi.md

33 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

WSGI Application in Apache
--------------------------
Install `apache2` and `libapache2-mod-wsgi`
2013-03-22 19:17:36 -04:00
We'll set up the database server at URL `http://myhost.com/nilmdb`.
The database will be stored in `/home/nilm/db`, and the process will
2013-03-25 13:52:32 -04:00
run as user `nilm`, group `nilm`.
First, create a WSGI script `/home/nilm/nilmdb.wsgi` containing:
import nilmdb.server
2013-03-25 13:52:32 -04:00
application = nilmdb.server.wsgi_application("/home/nilm/db", "/nilmdb")
The first parameter is the local filesystem path, and the second
parameter is the path part of the URL.
Then, set up Apache with a configuration like:
<VirtualHost>
WSGIScriptAlias /nilmdb /home/nilm/nilmdb.wsgi
WSGIDaemonProcess nilmdb-procgroup threads=32 user=nilm group=nilm
2013-03-25 13:44:03 -04:00
<Location /nilmdb>
2013-07-11 16:36:32 -04:00
WSGIProcessGroup nilmdb-procgroup
2013-07-10 14:16:25 -04:00
WSGIApplicationGroup nilmdb-appgroup
# Access control example:
2013-03-25 13:44:03 -04:00
Order deny,allow
Deny from all
Allow from 1.2.3.4
</Location>
</VirtualHost>