forked from gsathya/centinel-server
-
Notifications
You must be signed in to change notification settings - Fork 7
Use with Apache and WSGI
Abbas Razaghpanah edited this page Mar 30, 2015
·
1 revision
Install mod_wsgi
by:
sudo apt-get install libapache2-mod-wsgi
Add centinel server port to /etc/ports.conf by adding Listen 8082
to /etc/apache2/ports.conf
.
Assuming you are running Centinel server as the user iclab
, your virtual env is located at /home/iclab/env/
, add the following to /etc/apache2/sites-enabled/centinel.conf
:
<VirtualHost *:8082>
#ServerName iclab
WSGIDaemonProcess centinel-server user=iclab group=iclab threads=8
WSGIProcessGroup centinel-server
WSGIScriptAlias / /home/iclab/centinel-server/centinel-server.wsgi
SSLEngine on
SSLCertificateFile /home/iclab/certs/certificate.crt
SSLCertificateKeyFile /home/iclab/certs/key.key
SSLCertificateChainFile /home/iclab/certs/chain.crt
ErrorLog ${APACHE_LOG_DIR}/centinel_error.log
CustomLog ${APACHE_LOG_DIR}/centinel_access.log combined
<Directory /home/iclab/centinel-server/>
#WSGIProcessGroup centinel-server
#WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
</VirtualHost>
And setup your mod_wsgi with your virtual env by adding this line to your /etc/apache2/mods_available/wsgi.conf
:
WSGIPythonPath /home/iclab/env/lib/python2.7/site-packages
Now create your wsgi script in /home/iclab/centinel-server/centinel-server.wsgi
:
activate_this = '/home/iclab/env/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
import sys
sys.path.insert(0, '/home/iclab/centinel-server/')
sys.path.insert(0, '/home/env/lib/python2.7/site-packages')
import centinel
import centinel.models
import centinel.views
import config
from centinel import app as application