2013-07-02 11:16:44 -04:00
|
|
|
WSGI Application in Apache
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
Install `apache2` and `libapache2-mod-wsgi`
|
|
|
|
|
|
|
|
We'll set up the server at URL `http://myhost.com/nilmrun`. The
|
|
|
|
process will run as user `nilm`, group `nilm`.
|
|
|
|
|
|
|
|
First, create a WSGI script `/home/nilm/nilmrun.wsgi` containing:
|
|
|
|
|
|
|
|
import nilmrun.server
|
|
|
|
application = nilmrun.server.wsgi_application("/nilmrun")
|
|
|
|
|
|
|
|
The first parameter is the path part of the URL.
|
|
|
|
|
2013-07-06 15:37:10 -04:00
|
|
|
Then, set up Apache with a configuration like below. SSL and access
|
|
|
|
control/authentication are strongly recommended since this can execute
|
|
|
|
arbitrary commands.
|
|
|
|
|
|
|
|
<VirtualHost *:443>
|
|
|
|
SSLEngine On
|
2013-07-02 11:16:44 -04:00
|
|
|
|
|
|
|
WSGIScriptAlias /nilmrun /home/nilm/nilmrun.wsgi
|
|
|
|
WSGIDaemonProcess nilmrun-procgroup threads=32 user=nilm group=nilm
|
|
|
|
<Location /nilmrun>
|
2013-07-11 16:36:18 -04:00
|
|
|
WSGIProcessGroup nilmrun-procgroup
|
2013-07-10 14:16:35 -04:00
|
|
|
WSGIApplicationGroup nilmrun-appgroup
|
2013-07-06 15:37:10 -04:00
|
|
|
SSLRequireSSL
|
2013-07-10 14:16:35 -04:00
|
|
|
|
|
|
|
# Access control example:
|
2013-07-02 11:16:44 -04:00
|
|
|
Order deny,allow
|
|
|
|
Deny from all
|
|
|
|
Allow from 1.2.3.4
|
|
|
|
</Location>
|
|
|
|
</VirtualHost>
|