Update for apache 2.4
This commit is contained in:
parent
4ddfa26355
commit
c17520bc8a
|
@ -132,11 +132,27 @@ import nilmrun.server
|
|||
application = nilmrun.server.wsgi_application("/nilmrun")
|
||||
EOF
|
||||
|
||||
#### Edit apache config
|
||||
|
||||
# Create apache config by hacking up the default one. Might be a better way
|
||||
# to do this, and it'll probably break on apache 2.4, but...
|
||||
DEF=/etc/apache2/sites-available/default
|
||||
# to do this, and it'll probably break on new versions, but...
|
||||
|
||||
APACHE_VER=$(dpkg -s apache2 | grep ^Version | cut -d ' ' -f 2)
|
||||
if dpkg --compare-versions $APACHE_VER ge 2.4 ; then
|
||||
DEF=/etc/apache2/sites-available/000-default.conf
|
||||
NEED_PERMISSIONS=1
|
||||
else
|
||||
DEF=/etc/apache2/sites-available/default
|
||||
NEED_PERMISSIONS=0
|
||||
fi
|
||||
|
||||
# Cut out any existing NilmDB stuff
|
||||
perl -ne 'print unless /## NilmDB start/../## NilmDB end/' $DEF > $DEF.orig
|
||||
|
||||
# Copy everything up to the first </VirtualHost> line
|
||||
perl -ne 'print unless m-^[^#]*</VirtualHost>-..1' $DEF.orig > $DEF
|
||||
|
||||
# Add the NilmDB config
|
||||
cat >>$DEF <<"EOF"
|
||||
## NilmDB start
|
||||
WSGIScriptAlias /nilmdb /home/nilmdb/nilmdb.wsgi
|
||||
|
@ -152,10 +168,26 @@ cat >>$DEF <<"EOF"
|
|||
WSGIProcessGroup nilmrun-procgroup
|
||||
WSGIApplicationGroup nilmrun-appgroup
|
||||
</Location>
|
||||
EOF
|
||||
if [ $NEED_PERMISSIONS == 1 ] ; then
|
||||
cat >>$DEF <<"EOF"
|
||||
|
||||
<Directory /home/nilmdb>
|
||||
Options All
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
EOF
|
||||
fi
|
||||
cat >>$DEF <<"EOF"
|
||||
## NilmDB end
|
||||
EOF
|
||||
|
||||
# Copy everything including and after the first </VirtualHost> line
|
||||
perl -ne 'print if m-^[^#]*</VirtualHost>-..1' $DEF.orig >> $DEF
|
||||
|
||||
#### Done editing apache config
|
||||
|
||||
# Create nilmdb capture, processing, and cleanup files
|
||||
cat > /home/nilmdb/capture.sh <<"EOF"
|
||||
#!/bin/bash -e
|
||||
|
|
Loading…
Reference in New Issue
Block a user