2013-03-22 19:14:34 -04:00
|
|
|
WSGI Application in Apache
|
|
|
|
--------------------------
|
|
|
|
|
2013-03-23 15:57:09 -04:00
|
|
|
Install `apache2` and `libapache2-mod-wsgi`
|
2013-03-22 19:17:36 -04:00
|
|
|
|
2013-03-23 15:57:09 -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`.
|
2013-03-23 15:57:09 -04:00
|
|
|
|
|
|
|
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.
|
2013-03-23 15:57:09 -04:00
|
|
|
|
|
|
|
Then, set up Apache with a configuration like:
|
2013-03-22 19:14:34 -04:00
|
|
|
|
|
|
|
<VirtualHost>
|
2013-03-23 15:57:09 -04:00
|
|
|
WSGIScriptAlias /nilmdb /home/nilm/nilmdb.wsgi
|
2013-03-30 15:56:02 -04:00
|
|
|
WSGIApplicationGroup nilmdb-appgroup
|
|
|
|
WSGIProcessGroup nilmdb-procgroup
|
|
|
|
WSGIDaemonProcess nilmdb-procgroup threads=32 user=nilm group=nilm
|
2013-03-22 19:14:34 -04:00
|
|
|
|
2013-03-23 15:57:09 -04:00
|
|
|
# Access control example:
|
2013-03-25 13:44:03 -04:00
|
|
|
<Location /nilmdb>
|
|
|
|
Order deny,allow
|
|
|
|
Deny from all
|
|
|
|
Allow from 1.2.3.4
|
|
|
|
</Location>
|
2013-03-23 15:57:09 -04:00
|
|
|
</VirtualHost>
|